他のいくつかのテーブルでプレーしながらポーカー トーナメントに登録するプロセスを自動化するための小さなスクリプトを書いています。ロビー ウィンドウは背景にあり、プレイ時間になると手前に他のテーブルが飛び出します。したがって、登録するには、ロビーをフォアグラウンドに設定し (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