0

他のいくつかのテーブルでプレーしながらポーカー トーナメントに登録するプロセスを自動化するための小さなスクリプトを書いています。ロビー ウィンドウは背景にあり、プレイ時間になると手前に他のテーブルが飛び出します。したがって、登録するには、ロビーをフォアグラウンドに設定し (ctrl + 1)、アプリケーションが他のテーブルをポップアウトしないようにする必要があります (これを行うために繰り返しサイクルを使用しましたが、それが最善の方法かどうかはわかりません) )。

これらの遅延を 0.5 または 0.2 に設定すると、スクリプトが期待どおりに機能する理由がわかりません。それ以外の場合、スクリプトを実行しても機能しません (ロビーの登録ボタンをクリックしません)。

この 0.5 秒の間に他のテーブルが飛び出し、メイン ロビーからフォーカスを奪う可能性があるため、これは重要です。ボタンをクリックするためにピクセル座標を使用していることに注意してください。これは、Cocoa 以外のアプリケーションであり、ボタンを簡単にクリックできないためです。

どうすればこれを解決できますか?

--REGISTRATION PROCESS
--make sure we complete the reg process without other tables popping up and stealing focus from the tourney reg window
set done to false
repeat until done is true
    delay 0.5
    --Lobby focused
    tell application "System Events"
        set frontmost of process "PokerStarsIT" to true
        keystroke "1" using command down
        delay 0.2
    end tell

    --Start the registration process: click "register" button.
    tell application "PokerStarsIT"
        do shell script quoted form of POSIX path of mouseToolsPath & " -x " & (xCoordinate as text) & " -y " & (yCoordinate as text) & " -rightClick"
        set done to true                
    end tell
end repeat
4

1 に答える 1

1

私はこのようにしてみます。ウィンドウ 1 の名前を「ロビー」として使用していることに注意してください。ロビーウィンドウであるウィンドウの実際の名前を必ず入力してください。また、「do shell script」コマンドが PokerStarsIT アプリケーションの tell ブロッ​​クのコード内にないことにも気付くでしょう。「do shell script」は PokerStarsIT コマンドではなく、applescript コマンドです。また、「-rightClick」の代わりに「-leftClick」を使用する必要があると思います。幸運を。

tell application "PokerStarsIT" to activate
tell application "System Events"
    tell process "PokerStarsIT"
        repeat
            keystroke "1" using command down
            if name of window 1 is "Lobby" then exit repeat
        end repeat
    end tell
end tell

--Start the registration process: click "register" button.
do shell script quoted form of POSIX path of mouseToolsPath & " -x " & (xCoordinate as text) & " -y " & (yCoordinate as text) & " -leftClick"
于 2012-10-28T20:18:17.613 に答える