Re: 'Make new attachment' dilemma
Re: 'Make new attachment' dilemma
- Subject: Re: 'Make new attachment' dilemma
- From: Shane Stanley <email@hidden>
- Date: Thu, 28 May 2015 10:07:08 +1000
On 27 May 2015, at 11:54 pm, Yvan KOENIG <email@hidden> wrote: set pb to current application's NSPasteboard's generalPasteboard() -- get pasteboard set theData to pb's dataForType:"public.tiff" -- get tiff data off pasteboard if theData = missing value then error "No tiff data found on clipboard"
It would probably be more generally useful if it wasn't confined to just TIFF on the clipboard. This version will check for several formats, in order, and return the first it finds:
set pb to current application's NSPasteboard's generalPasteboard() -- get pasteboard set theType to pb's availableTypeFromArray:{current application's NSPasteboardTypeTIFF, current application's NSPasteboardTypePNG, current application's NSPasteboardTypePDF, "public.jpeg", "com.compuserve.gif", "com.microsoft.bmp"} -- returns first type found if the type is missing value then error "No suitable image data found on the clipboard" set theData to pb's dataForType:theType
|
_______________________________________________
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