Pasting text and images together?
paul at researchware.com
Fri Sep 1 18:02:23 EDT 2023
If the App copying the mixed content places it on the clipboard as text
and an image vs some mixed type, you may be able to do this
Your have the on pasteKey message to trap CONTROL/COMMAND-V and if you
have a "Paste" menu item, you control the script for that.
the ClipboardData, the fullClipBoardData, and the rawClipboardData
arrays (see Dictionary entries for each of these) give you access to the
different elements on the clipboard. I epect the rawClipboardData will
not really apply to this goal, but whether the ClipboardData or
fullClipboardData would be better, I'm not sure
Essential for either the pasteKey or menu paste action, you scrip wants to
put the ClipboardData["text"] into tMyText -- the text copied to the
put the ClipboardData["image"] into tMyImageData -- the text property of
an image object
As a test, you may need to write a small test handler
local tClipArray, tFullClipArray
put the ClipBoardData into tClipArray
put the fullClipboardData into tFullClipArray
Copy mixed data to your clipboard from your 3rd party app, switch to a
test stack with the script above (not tested), and press the paste keys
for your OS. The IDE debugger should appear and let you look at the
arrays tClipArray and tFullClipArray to see how the data was translated
from your 3rd party app.
On 9/1/2023 3:32 PM, David Epstein via use-livecode wrote:
> To clarify my original question:
> I'm not expecting the built-in paste command to handle this task; I'm
> wondering if I can script my own paste command to handle it.
> Richmond, I can write a script to "paste" an image by itself (by creating
> an image and setting its text to clipboardData["image"]).
> But is there some way I can access both the text and the image that are on
> the clipboard after I have copied a combination of those from, e.g., a web
> browser? (Pasting to Apple Notes confirms that the clipboard contains both
> text and image.)
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode