Re: AppleScript to automatically paste clipboard image to a file.
Re: AppleScript to automatically paste clipboard image to a file.
- Subject: Re: AppleScript to automatically paste clipboard image to a file.
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 22 Jan 2011 09:35:25 -0500
So you just need a script that saves the clipboard to a file, which
you can bind to a key with something like Quicksilver.
The problem is, in order to do that from pure AppleScript, you have to
know ahead of time what *kind* of image will be in the clipboard (GIF,
JPEG, PNG, . . . ). The code looks like this:
write (the clipboard as GIF picture) to someFile
etc. So you need to restrict the sort of images you copy, or define a
separate keystroke/script for each format, or something.
Or, you could install a scriptable application that does it for you.
Graphic Converter is a popular choice.
The built-in Preview.app will do it, but you have to use GUI
scripting. Getting the image is straightforward:
tell application "Preview" to activate
tell application "System Events"
tell process "Preview"
keystroke "n" using {command down}
end
end
But scripting the "Save as" dialog is going to be painful.
On Sat, Jan 22, 2011 at 8:48 AM, Jeff Gold <email@hidden> wrote:
> I need an AppleScript Application to do the following...
>
> Anytime I hit Command-C and copy an *IMAGE* to the Clipboard, my AppleScript Application detects the Clipboard contents have changed, and saves the current Clipboard image contents of a file called Clipboard.jpg, overwriting whatever might have previously been in that file.
>
> Another option would be that this AppleScript could be triggered by a Function Key. So, for example, I could type Command-C to copy the image, then press F1 and the AppleScript would then automatically save the Clipboard image to Clipboard.jpg.
>
> Any suggestions?
>
> Best wishes,
>
> - Jeff Gold
>
> _______________________________________________
> 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
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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