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

Tha*_*Cow 11 clipboard applescript

我想创建一个使用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
Run Code Online (Sandbox Code Playgroud)

jwe*_*aks 16

你只需使用

set the clipboard to "Some text"
Run Code Online (Sandbox Code Playgroud)

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

set the clipboard to {text:(outputText as string), Unicode text:outputText}
Run Code Online (Sandbox Code Playgroud)