3

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

AppleScript Editor からの実行は機能しません。作成したアプリから動作するようにしました。PCSX と img.bin は、生成されたパッケージ内にあります。

を押すと、ダイアログcommand+iが開き、クリックしてから"Go to the folder"GoOpen

しかし、この方法では、ダイアログ ボックスが見つかりません。私は何を間違っていますか?

4

2 に答える 2

5

[移動] と [開く] がデフォルトのボタンである場合は、次を試してください。

tell application "System Events"
    keystroke return
    delay 2
    keystroke return
end tell

PCX はインストールしていませんが、ここでは、Finder の [フォルダーへ移動] コマンドから [移動] ボタンをクリックする方法の例を示します。

tell application "System Events"
    tell process "Finder"
        click button "Go" of window "Go to Folder"
    end tell
end tell
于 2013-01-14T14:36:04.763 に答える
1

スクリプトが AppleScript エディタから機能しない理由は、「path to me」の「me」が AppleScript を実行したアプリケーションであるためです。AppleScript Editor で AppleScript を実行している場合、それは AppleScript Editor 自体を意味します。AppleScript をスクリプト アプリケーションとして保存して実行すると、パスはスクリプト アプリケーションを指していました。これは、独自の AppleScript を実行していたためです。

また、これは正しくありません:

tell process "Finder"
        click button "Go" of window "Go to Folder"
end tell

「Go」ボタンは、「Go to Folder」ウィンドウにはありません。これは、現在表示されているフォルダーの名前を持つ Finder ウィンドウに添付されているシートにあります。したがって、ウィンドウ 1 のシート 1 にあるボタンを記述する必要があります。

tell application "System Events"
    tell process "Finder"
        click button "Go" of sheet 1 of window 1
    end tell
end tell

…しかし、別のアプリでは、シート上の同様の外観のボタンが、ウィンドウ 3 のグループ 2 のグループ 1 のシート 1 にある場合があることに注意してください。UI スクリプトは複雑です。

于 2014-08-11T10:13:35.823 に答える