nox_adb
nox_adb.exeのパスを確認する
特にいじらなければ↓にあるはずです。
"C:/Program Files (x86)/Nox/bin"
スクショをとる
import subprocess
directory = "C:/Program Files (x86)/Nox/bin"
def cmdRun(cmd):
subprocess.run( cmd, \
stdout=subprocess.PIPE, \
shell=True, \
cwd=directory, \
universal_newlines=True, \
timeout=10 ).stdout
# スクショをとってsdcardディレクトリにしまう(それをShell上で実行する)
command1 = "nox_adb shell screencap -p /sdcard/capture.png"
# sdcardディレクトリ内のファイルをローカルにダウンロードする
command2 = "nox_adb pull /sdcard/capture.png ../../../Users/xxxxx/Downloads"
cmdRun(command1)
cmdRun(command2)
上記を実行するとC:/Program Files (x86)/Nox/bin内にcapture.pngというファイルが生成される。
※バッククォーテーションを使うことで長いコードを改行して見やすくできる
タップ操作
command = "nox_adb shell input touchscreen tap" + str(xPos) + " " + str(yPos)
X座標、Y座標はウィンドウサイズが変わっても問題なかった
ちなみにアズレンの場合、
str(xPos) str(yPos)
戻るボタン 100 100
三角ボタン 100 400
燃料ボタン 200 100
金ボタン 400 100
編成ボタン 1600 800
建造 1600 1000
建造開始 1700 900
確定 1200 750
一括完了 1800 200
母港 900 1000
寮舎 700 700
参考サイト
ADBコマンドで調べると出てくる。あとはadb の部分を nox_adb に直すだけ。
基本的な使い方 → (https://qiita.com/minkmaguro/items/9d4e7c0c1ba8827f1987)
(https://hrkworks.com/it/smartphone/adb_shell01/)
アズレン自動化 → (http://mongo.s25.xrea.com/game/)
BACK