标签:dmi else admin blog UI span 项目 screen 匹配
import pyautogui, time, os, pyautogui os.chdir(‘C:\\Users\\Administrator\\Python35-32\\test\\kuaisu‘) guests = open(‘sendMesTo.txt‘)#打开好友名单 for n in guests: pyautogui.click(1300, 1, button=‘left‘) #用的是QQ,鼠标移动到屏幕右上角,QQ弹出窗口 time.sleep(1) pyautogui.typewrite(n);pyautogui.press(‘enter‘) #输入好友名并按Enter time.sleep(2) if pyautogui.locateOnScreen(‘foundNone.png‘) == None : #如果没有好友则会弹出搜索窗,如未匹配到搜索窗图片,则输入Hello pyautogui.typewrite(‘Hello‘) pyautogui.keyDown(‘ctrlleft‘); pyautogui.press(‘enter‘);pyautogui.keyUp(‘ctrlleft‘) time.sleep(1) print(n) else : print(‘Not found %s ‘ %n) #如果匹配到搜索窗图片,则输入 Not found
python编程快速上手之第18章实践项目参考答案(18.4.2)
标签:dmi else admin blog UI span 项目 screen 匹配
原文地址:http://www.cnblogs.com/flying-wyf/p/6965257.html