尝试使用python和adb使用变量到命令提示符
import os
import random
xpixel = random.randint(359,402)
ypixel = random.randint(256,368)
trest = random.randint(10,16)
print(trest)
time.sleep(trest)
print(xpixel)
print(ypixel)
os.system('cmd /k adb.exe shell input tap xpixel ypixel') <----I know this part is absolutly wrong but the concept is to be able to input those two numbers into command prompt some how.
我正在尝试使用Python/ ADB单击屏幕中的一个点。 我知道如何生成随机数以及ADB命令。我只是不知道如何传输这些变量并使它们在命令提示中有用。
import os
import random
xpixel = random.randint(359,402)
ypixel = random.randint(256,368)
trest = random.randint(10,16)
print(trest)
time.sleep(trest)
print(xpixel)
print(ypixel)
os.system('cmd /k adb.exe shell input tap xpixel ypixel') <----I know this part is absolutly wrong but the concept is to be able to input those two numbers into command prompt some how.
I'm trying to click on a point in a screen using python/ adb.
I know how to generate the random number, and also the adb command. I just don't know how to transfer those variables and make them useful in command prompt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然您可以使用f-string包含变量值,但是
如果不使用
adb
和input
您使用更具体的库,则可能会更好/Github.com/dtmilano/androidviewclient/“ rel =“ nofollow noreferrer”> androidViewClient/culebra 或任何其他人都可以做某事。像这样While you can include variable values using f-strings
it might be better if instead of using
adb
andinput
you use a more specific library like AndroidViewClient/culebra or any other, to be able to do something. like this