AppleScript 单击对话框

gha*_*hel 3 macos applescript

在 PCSX(ps1 模拟器)中,我试图自动执行播放 iso 的步骤。所以,我正在这样做:

set thepath to path to me
set thesecondpath to POSIX path of thepath
set thethirdpath to "Contents/PSX/ROMS/img.bin"
set thefourthpath to "/Contents/PSX/PCSX.app"
set thefifthpath to thesecondpath & thefourthpath
set theultimatepath to thesecondpath & thethirdpath

tell application thefifthpath
    activate
    tell application "System Events"
        keystroke "i" using {command down}
        keystroke theultimatepath
        delay 1.0
        tell process "PCSX"
            click button "Go"
        end tell
        key code 53
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)

从 AppleScript 编辑器运行将不起作用。我让它从它创建的应用程序运行。PCSX 和 img.bin 位于生成的包内。

按后command+i,它会打开一个"Go to the folder"对话框,我需要单击Go然后Open

但这样做,它不会找到该对话框。我究竟做错了什么?

ada*_*one 5

如果“转到”和“打开”是默认按钮,请尝试:

tell application "System Events"
    keystroke return
    delay 2
    keystroke return
end tell
Run Code Online (Sandbox Code Playgroud)

虽然我没有安装 PCX,但这里是如何从 Finder 的“转到文件夹”命令中单击“转到”按钮的示例。

tell application "System Events"
    tell process "Finder"
        click button "Go" of window "Go to Folder"
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)