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