登陆

import time
import win32gui, win32ui, win32con, win32api

from PIL import Image
import pytesseract
import os

qqu, qqp = ('2235', 'h2020')

# 将app窗口置为当前窗口,等效点,选3个,点击
time.sleep(6)
l = [(15, 81), (23, 120), (22, 126)]
for i in l:
x, y = i
win32api.SetCursorPos([x, y])
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)

#登陆口qq
qqx, qqy = (358, 239)
x,y=qqx,qqy
win32api.SetCursorPos([x, y])
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(10)

import win32clipboard

qqu_p, qqp_p=(93,347),(151,447)

#点击账号输入区,调出搜狗输入法app
x,y=qqu_p
for i in range(20):
win32api.SetCursorPos([x, y])
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
# time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(1)
print(i)

#剪切板内容赋值
for i in range(10):
win32clipboard.OpenClipboard()
# win32clipboard.EmptyClipboard()
ms =qqu
win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, '')
win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, ms)

cs = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
print(i,cs)

#搜搜输入法,输入至目标区

#复制-粘贴路径1
input_app_p=[(344,635),(463,793)]
#复制-粘贴路径2
input_app_pb=[(49,623),(497,979),(287,710)]

for i in input_app_pb:
x,y=i
win32api.SetCursorPos([x, y])
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
time.sleep(10)





posted @ 2018-02-02 15:01  papering  阅读(236)  评论(0编辑  收藏  举报