【问题标题】:Copy and Paste text from Dialogue Box in Applescript从 Applescript 的对话框中复制和粘贴文本
【发布时间】:2014-01-28 06:50:45
【问题描述】:

我正在编写一个脚本,需要从对话框中的条目中复制和粘贴文本

set query to text returned of (display dialog "Enter Text" default answer "" buttons {"Input", "Cancel"} default button 1)
query
tell application "System Events"
    keystroke "c" using command down
    keystroke "v" using command down
end tell

当我运行此脚本时,它会复制并粘贴“将查询设置为文本...”

如何复制我输入的查询?我稍后将把文本粘贴到其他地方,但我需要弄清楚如何实际复制文本。我正在使用击键查询,但是当字符串很长时会花费很长时间

【问题讨论】:

    标签: copy applescript paste dialog


    【解决方案1】:

    使用set the clipboard:

    display dialog "" default answer ""
    set the clipboard to text returned of result
    

    如果其他人在这里搜索如何从 OS X 显示的对话框复制长错误消息,您可以使用 Accessibility Inspector,它位于 /Applications/Xcode.app/Contents/Applications/

    【讨论】:

      最近更新 更多