Pasting text and images together

Paul Dupuis paul at researchware.com
Sat Sep 2 18:24:32 EDT 2023


Your right. Something about the rawClipboardData fails with an error. 
Trying the fullClipboardData (code below) works. My guess is that there 
may be something about the first key (on my Windows system that is 
"text/html" where the slash is causing an error?  I'd need to look at it 
further - perhaps skip that key and try others. This may be a bug that 
may be worth reporting in the LC Quality center. You might get what you 
want from the fullClipboardData (below)


on mouseUp pMouseButton
   local n=1
   lock clipboard
   --
   put the keys of the fullClipboardData into myK3  ## THIS WORKS
   --
   repeat for each line k in myK3
     try
       put the fullClipboardData[k] into temp[n]  ## DOESN’T WORK
     catch myError
       put myError into e4[n] ## ERROR IS TRIGGERED
     end try
     add 1 to n
   end repeat
   unlock clipboard
end mouseUp


On 9/2/2023 5:07 PM, David Epstein via use-livecode wrote:
> Paul, getting the keys of the rawClipboardData worked for me too.  What didn’t work was trying to read the values.  See this part of my script, I hope shown this time without the asterisks gMail added before:
>
>     lock clipboard
>>     put the keys of the rawClipboardData into myK3  ## THIS WORKS
>>     repeat for each line k in myK3
>        try
>           put the rawClipboardData[k] into temp[n]  ## DOESN’T WORK
>        catch myError
>           put myError into e4[n] ## ERROR IS TRIGGERED
>        end try
>        add 1 to n
>     end repeat
>     unlock clipboard
>
>
>
>> From: Paul Dupuis <paul at researchware.com>
>> To: use-livecode at lists.runrev.com
>> Subject: Re: Pasting text and images together?
>> Message-ID: <3814cd2a-0f20-2bbb-8783-42fc57e68705 at researchware.com>
>> Content-Type: text/plain; charset=UTF-8; format=flowed
>>
>> Since my method didn't work, I'd try Marks, namely to put the keys of
>> the clipboard array into a variable to look at
>>
>> on mouseUp
>> ? lock clipboard
>> ? put the keys of the clipboarddata into tKeys1
>> ? put the keys of the fullclipboarddata into tKeys2
>> ? put the keys of the rawclipboarddata into tkeys3
>> ? breakpoint
>> ? unlock clipboard
>> end mouseUp
>>
>> I tested this in LC 10dp6 and it works. Once you see what keys are
>> present with your mixed text and images copied to the clipboard, you can
>> choose which clipboard array and keys to work with to get the data.
>>
>> -- Paul
>>
>>
>>> On 9/2/2023 10:36 AM, David Epstein via use-livecode wrote:
>>> Many thanks to Paul Dupuis and Mark Waddingham.  The script below tries to
>>> test their suggestions.  Using 10.0.0 dp5 on an Intel Mac, and watching
>>> execution after the breakpoint, I get errors at each "try" in the script.
>>> So it does not seem that I can write the fullClipboardData
>>> or rawClipboardData to an array variable; and it does not seem that I can
>>> access any element of the rawClipboardData array.  Further advice is
>>> welcome.
>>>
>>> Best wishes,
>>> David Epstein
>>>
>>> *on* a2
>>>
>>> *lock* clipboard
>>>
>>> *put* the keys of the clipboardData into myK1
>>>
>>> *put* the keys of the fullClipboardData into myK2
>>>
>>> *put* the keys of the rawClipboardData into myK3
>>>
>>> *breakpoint*
>>>
>>> *try*
>>>
>>> *put* the fullClipboardData into ta2
>>>
>>> *catch* myError
>>>
>>> *put* myError into e2
>>>
>>> *end* *try*
>>>
>>> *try*
>>>
>>> *put* the rawClipboardData into ta3
>>>
>>> *catch* myError
>>>
>>> *put* myError into e3
>>>
>>> *end* *try*
>>>
>>> *put* 1 into n
>>>
>>> *repeat* for each line k in myK3
>>>
>>> *try*
>>>
>>> *put* the rawClipboardData[k] into temp[n]
>>>
>>> *catch* myError
>>>
>>> *put* myError into e4[n]
>>>
>>> *end* *try*
>>>
>>> *add* 1 to n
>>>
>>> *end* *repeat*
>>>
>>> *unlock* clipboard
>>>
>>> *end* a2
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list