0

我有错误;无法获得进程“TextEdit”的“保存”按钮。

 activate application "TextEdit"
 tell application "System Events" to tell process "TextEdit"
 keystroke "s" using {command down}
 click button "save"
 end tell

我也试图包含“窗口 1”之类的内容,但我仍然无法正常工作。任何帮助都感激不尽。谢谢

4

1 回答 1

2

为什么不直接与应用程序对话?

tell application "TextEdit"
    tell document 1 to save
end tell

如果必须使用 GUI,则需要正确的层次结构(但最好直接与应用程序对话)

activate application "TextEdit"
tell application "System Events"
    tell process "TextEdit"
        keystroke "s" using {command down}
        delay 1
        click button "Save" of sheet 1 of window 1
    end tell
end tell
于 2013-10-30T17:27:48.010 回答