简体   繁体   English

Python中的自动按键

[英]automatic press key in Python

im currently trying to make a auto-clicker and then a auto-button presser. 我目前正在尝试制作一个自动点击器,然后一个自动按钮按下器。

this is my code until now. 到目前为止,这是我的代码。

new=2;
url="www.google.com";

webbrowser.open(url,new=new);

time.sleep(25)


def click(x,y):
          win32api.SetCursorPos((x,y))
          win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
          win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
click(700,300)

time.sleep(3)

And after time.sleep(3) I want the spacebar to be pressed automatic (with 3sec sleep in between) 100 times. 在time.sleep(3)之后,我希望将空格键自动按100次(两次之间有3秒的睡眠)。 I have tried sendkeys, but cant find any download place. 我已经尝试过sendkeys,但是找不到任何下载位置。

Sorry for bad english, hope someone can help. 对不起,英语不好,希望有人能帮忙。

这个问题这个 问题可能会对您有所帮助,您可能应该搜索这些内容并在发布之前检查是否已经存在类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM