Applescript 粘贴时如何删除文本

Applescript 粘贴时如何删除文本,applescript,Applescript,我经常从iBook上复制和粘贴,以便个人记录。如何创建一个脚本,每当我粘贴到任何应用程序中时,该脚本将自动删除“摘录自”以及该文本后面的所有单词?粘贴之前,您必须运行该脚本,它可能看起来像这样: try set c to the clipboard as text considering case --to match exactly set o to offset of "Excerpt From" in c end considering se

我经常从iBook上复制和粘贴,以便个人记录。如何创建一个脚本,每当我粘贴到任何应用程序中时,该脚本将自动删除“摘录自”以及该文本后面的所有单词?

粘贴之前,您必须运行该脚本,它可能看起来像这样:

try
    set c to the clipboard as text
    considering case --to match exactly
        set o to offset of "Excerpt From" in c
    end considering
    set the clipboard to (text beginning thru (o - 1) of c)
on error e
    display dialog e
end try
--给定剪贴板上的文本,如
“1234------摘自0987654”
,您将得到
“1234------”