赞
踩
#coding: utf-8
importwin32gui, win32api, win32conimporttimeimportwin32clipboard as wimportloggingdefclick_position(hwd, x_position, y_position, sleep):"""鼠标左键点击指定坐标
:param hwd:
:param x_position:
:param y_position:
:param sleep:
:return:"""
#将两个16位的值连接成一个32位的地址坐标
long_position =win32api.MAKELONG(x_position, y_position)#win32api.SendMessage(hwnd, win32con.MOUSEEVENTF_LEFTDOWN, win32con.MOUSEEVENTF_LEFTUP, long_position)
#点击左键
win32api.SendMessage(hwd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, long_position)
win32api.SendMessage(hwd, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, long_position)
time.sleep(int(sleep))defgetText():#读取剪切板
w.OpenClipboard()
d=w.GetClipboardData(win32con.CF_TEXT)
w.CloseClipboard()returnddefsetText(aString):#写入剪切板
w.OpenClipboard()
w.EmptyCli
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。