• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 'Make new attachment' dilemma
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


-- 
Shane Stanley <email@hidden>
<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

References: 
 >Re: 'Make new attachment' dilemma (From: Brian Christmas <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Shane Stanley <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Brian Christmas <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Yvan KOENIG <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Shane Stanley <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Yvan KOENIG <email@hidden>)
 >Re: 'Make new attachment' dilemma (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: 'Make new attachment' dilemma
  • Next by Date: Can I speed up Mail content setting?
  • Previous by thread: Re: 'Make new attachment' dilemma
  • Next by thread: Applescript counting mails keeps counting mail in other folders
  • Index(es):
    • Date
    • Thread