Hello all
A script to copy an image in Safari or Chrome and create a new Preview document with the content of the clipboard is it possible on Mojave?
Thanks a lot
Take a look here:
There doesn’t seem to be any (obvious, to me, anyway) way to get Preview to create a new document from the clipboard.
The two alternative approaches - one, like Mockman points you to, is to use UI scripting to invoke Preview’s New From Clipboard option, the other is to write the image data to a file and have Preview open that file.
Saving the image to a file is pretty easy, but you’ll end up with temp files, which may or may not get in the way of your workflow:
set c to the clipboard as JPEG picture
set f to open for access file ((path to desktop as text) & "tmp.jpg") with write permission
set eof f to 0
write c to f
close access f