• 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: Problem Reading Clipboard with Evernote URLs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem Reading Clipboard with Evernote URLs


  • Subject: Re: Problem Reading Clipboard with Evernote URLs
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 24 Jun 2016 10:11:57 +1000

On 24 Jun 2016, at 3:05 AM, Jim Underwood <email@hidden> wrote:

I have tried lots of things, and cannot make this work.
• The clipboard has 3 links, put there by Evernote.
• When I read in AppleScript, it shows only one link
• If I just do a normal, manual, paste, all 3 links are pasted
Any ideas on how to get all 3 links in AppleScript?

In OS X 10.5 and earlier, the clipboard could hold only one item. In 10.6 Apple introduced the ability to have multiple items on the clipboard. For backwards compatibility, anything using the old approach just sees the first item -- this mostly works because most apps still only put one item on the clipboard.

Anyway, the short answer is that AppleScript's clipboard command still only sees the first item on the clipboard. 

Log a bug. While you're waiting, you can use AppleScriptObjC.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "AppKit" -- for pasteboard
use scripting additions

-- get the pasteboard items
set theClip to current application's NSPasteboard's generalPasteboard()
set pbItems to theClip's pasteboardItems()
set theStrings to {} -- store values here
repeat with anItem in pbItems
-- check the item contains a string
if (anItem's |types|()'s containsObject:(current application's NSPasteboardTypeString)) then
-- add the string to the list
set end of theStrings to (anItem's stringForType:(current application's NSPasteboardTypeString)) as text
end if
end repeat
return theStrings

-- 
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

  • Follow-Ups:
    • Re: Problem Reading Clipboard with Evernote URLs
      • From: Jim Underwood <email@hidden>
    • Re: Problem Reading Clipboard with Evernote URLs
      • From: Christopher Stone <email@hidden>
  • Prev by Date: AppleScript "standard libraries" project - need to hand off now
  • Next by Date: Re: Swift
  • Previous by thread: Re: AppleScript "standard libraries" project - need to hand off now
  • Next by thread: Re: Problem Reading Clipboard with Evernote URLs
  • Index(es):
    • Date
    • Thread