我在AppleScriptObjC上找到了方法,並發現Shane Stanley的Everyday AppleScriptObjC有幫助。但我仍然很難知道從哪裏開始NSPasteboard
。如何使用AppleScriptObjC和NSPasteboard讀取剪貼板
這是我到目前爲止有:
use AppleScript version "2.4"
use framework "Foundation"
use framework "AppKit"
use scripting additions
on readClipboard(theClipboard)
set theClipboard to current application's NSPasteboard
return theClipboard as text
end readClipboard
set theContents to missing value
its readClipboard(theContents)
當然,這是行不通的。但它似乎在做一些事情。
它返回:
error "Can’t make «class ocid» id «data optr000000002852F974FF7F0000» into type text." number -1700 from «class ocid» id «data optr000000002852F974FF7F0000» to text
任何指針將不勝感激。
任何理由不只是使用加標'的clipboard'命令? – foo 2015-03-25 07:41:24
我應該圍繞從剪貼板中檢索程序特定數據並將其作爲文本讀取來構建問題。 '剪貼板'不這樣做。 – user3803526 2015-03-25 18:26:24