Re: Copy Picture to Clipboard
Re: Copy Picture to Clipboard
- Subject: Re: Copy Picture to Clipboard
- From: Shane Stanley <email@hidden>
- Date: Thu, 06 Jan 2011 12:37:56 +1100
- Thread-topic: Copy Picture to Clipboard
On 6/1/11 12:20 PM, "Jim Thompson" <email@hidden> wrote:
> Hello. I want to send a PNG picture to the clipboard. If I run the following
> code, I'll get the file path as a string instead of as a picture.
>
> set myPict to "SDHC MEMORY:More:graduation.png:"
> tell application "Finder"
> set the clipboard to myPict
> end tell
You have a few problems there. First, if the path ends in a colon, it's a
folder, not a file. Second, as it stands it's just a string -- if you want a
file, you need to insert "alias" before the path. This also has nothing to
do with the Finder, so leave it out.
The biggest problem, though, is that you can't set the contents of the
clipboard to something you don't have, and your script doesn't have the
picture -- all you have is its path. You can put an alias to the file on the
clipboard:
set the clipboard to alias "SDHC MEMORY:More:graduation.png"
But if you want the actual image that you can paste into a graphics program,
you're probably out of luck. You would have to first read the file as a png,
which is not something AppleScript can do.
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden