【发布时间】:2014-04-16 10:40:52
【问题描述】:
我创建了一个可以读取文本文件并将内容提供给剪贴板的 droplet:
on open theFile
open for access theFile
set fileContents to (read theFile)
close access theFile
return fileContents
set the clipboard to fileContents
end open
但我正在寻找一些代码来从剪贴板中获取这些内容 并将其插入到 safari 最前面窗口的当前字段中。
为此,我发现了一些用于自动操作的代码 以某种方式模拟 cmd+v 的击键:
on run {input, parameters}
tell application "Safari"
activate
tell application "System Events"
keystroke "v" using command down
end tell
return input
end tell
end run
我的问题是如何把这两件事放在一起。 最后,液滴应该以这种方式工作:
- 在 droplet 上放置文本文件
- 在最前面的 Safari 窗口的活动字段中插入文本文件的内容。
感谢帮助
【问题讨论】:
标签: safari applescript