Python之Windows控件操作系列一:模拟鼠标点击
2012-01-18 08:47
681 查看
/content/4935423.html模拟鼠标点击指定窗口中的指定button:
import win32gui,win32api
win = win32gui.FindWindow(None,DialogName)
while win == 0:
win = win32gui.FindWindow(None,DialogName)
time.sleep(X) # 休眠X秒
hbtn = win32gui.FindWindowEx(win,None,None,ButtonName)
(left,top,right,bottom) = win32gui.GetWindowRect(hedit)
win32api.SetCursorPos((left+(right-left)/2,top+(bottom-top)/2)) #光标定位
time.sleep(0.5)
# 鼠标点击
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(0.05)
Always go with the choice that scares you the most, because that's the one that is going to require the most from you!
import win32gui,win32api
win = win32gui.FindWindow(None,DialogName)
while win == 0:
win = win32gui.FindWindow(None,DialogName)
time.sleep(X) # 休眠X秒
hbtn = win32gui.FindWindowEx(win,None,None,ButtonName)
(left,top,right,bottom) = win32gui.GetWindowRect(hedit)
win32api.SetCursorPos((left+(right-left)/2,top+(bottom-top)/2)) #光标定位
time.sleep(0.5)
# 鼠标点击
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(0.05)
Always go with the choice that scares you the most, because that's the one that is going to require the most from you!
相关文章推荐
- Python之Windows控件操作系列一:模拟鼠标点击
- windows下python模拟鼠标点击和键盘输示例
- Dev系列控件之XtraChart高级应用(模拟flash鼠标移动,点击实现相关信息提示)
- python模拟鼠标点击和键盘输入的操作
- Python实现windows下模拟按键和鼠标点击的方法
- windows下python模拟鼠标点击和键盘输示例
- [python]windows下模拟鼠标点击和键盘输入
- Python实现windows下模拟按键和鼠标点击的方法
- Dev系列控件之XtraChart高级应用(模拟flash鼠标移动,点击实现相关信息提示)
- Python实现windows下模拟按键和鼠标点击的方法
- Python在windows下模拟按键和鼠标点击代码
- windows下python模拟鼠标点击和键盘输示例
- python模拟鼠标点击
- Python 模拟鼠标操作
- Python-pyautogui包-模拟鼠标点击
- 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")
- python模拟鼠标键盘操作 GhostMouse tinytask 调用外部脚本或程序 autopy右键另存为
- 使用powershell/vbs自动化模拟鼠标点击操作
- python + selenium webdriver 通过python来模拟鼠标、键盘操作,来解决SWFFileUpload调用系统底层弹出框无法定位问题
- 利用Python实现Windows下的鼠标键盘模拟的实例代码