如何使用AppleScript将文本复制到剪贴板

时间:2014-01-17 01:59:35

标签: applescript clipboard

我想使用AppleScript创建一个应用程序来复制系统信息并通过电子邮件发送给自己。我知道要做电子邮件方面,以及如何使电子邮件具有剪贴板中的任何内容。我如何使用AppleScript编码将文本复制到剪贴板?

如果它有帮助,可以通过电子邮件发送给剪贴板中的任何内容:

set a to "uselessdecoy@gmail.com"
tell application "Mail"
tell (make new outgoing message)
set subject to (the clipboard)
set content to "content"
make new to recipient at end of to recipients with properties {address:a}
send
end tell
end tell

1 个答案:

答案 0 :(得分:13)

您只需使用

set the clipboard to "Some text"

您也可以直接分配到剪贴板的各个部分(纯文本,unicode,pict),如下所示:

set the clipboard to {text:(outputText as string), Unicode text:outputText}