def buscar_campo_id(): msg = '' pyautogui.PAUSE = 0.5 pyautogui.FAILSAFE = False pyperclip.copy('') dondeEstaElCampoID = pyautogui.locateOnScreen('operator-id-field.png') if dondeEstaElCampoID is None: msg = 'El campo de OPERATOR-ID no fue encontrado' return (False, msg) else: campoIDPos = list(dondeEstaElCampoID) #print campoIDPos centrocampoID = pyautogui.center(campoIDPos) #print centrocampoID pyautogui.moveTo(centrocampoID) pyautogui.click(None,None,2) pyautogui.typewrite('operador1') pyautogui.press('enter') pyautogui.press('enter') pyautogui.press('enter') return (True, msg)
def episode_gp(): pya.hotkey('alt', 'a') pya.typewrite(['tab'] * 4, interval=0.1) gp = pyperclip.copy('empty') pya.hotkey('ctrl', 'c') gp = pyperclip.paste() return gp
def send_command(self, cmd): self.save_screenshot() pyautogui.hotkey('ctrl', 'space') pyautogui.typewrite(cmd) self.save_screenshot() pyautogui.press('enter') pyautogui.press('escape')
def buscar_campo_serial(serial_number): msg = '' pyautogui.PAUSE = 0.5 pyautogui.FAILSAFE = False pyperclip.copy('') dondeEstaElCampoSerial = pyautogui.locateOnScreen('operator-id-field.png') if dondeEstaElCampoSerial is None: msg = 'El campo de SERIAL NUMBER no fue encontrado' return (False, msg) else: campoSerialPos = list(dondeEstaElCampoSerial) #print campoSerialPos centrocampoSerial = pyautogui.center(campoSerialPos) #print centrocampoSerial pyautogui.moveTo(centrocampoSerial) pyautogui.click(None,None,2) #pyautogui.typewrite('C3WB4E768226230') pyautogui.typewrite(serial_number) pyautogui.press('enter') #pyautogui.press('enter') #pyautogui.press('enter') return (True, msg)
def output_doulist(input_list): # 1. find button and change focus in browser button_pos = pyautogui.locateOnScreen('output/add_button.png') if not button_pos: # no valid button print '没有找到有效的"添加内容"按钮, 请检查后再次导出.' return elif len(list(pyautogui.locateAllOnScreen('output/add_button.png'))) > 1: # more than one valid button print '屏幕中有多个有效的"添加内容"按钮, 请检查后再次导出.' return else: # valid input: only one button available # remaining issue: the picture is not alwas found in screen...that's strange. pyautogui.click(button_pos) for i in input_list: # 2. press button time.sleep(4) pyautogui.click(button_pos) # 3. write link time.sleep(2) pyautogui.typewrite(i) pyautogui.press('enter') # 4. add to Doulist time.sleep(2) pyautogui.press('tab') pyautogui.press('tab') pyautogui.press('tab') pyautogui.press('enter') print 'iDoulist: 书籍列表已被添加到屏幕上的豆列中.'
def fillTown(town): pyautogui.typewrite(town) time.sleep(0.7) pyautogui.hotkey('down') pyautogui.hotkey('down') pyautogui.hotkey('tab') pyautogui.hotkey('tab')
def key(self,evt): 'See if key press is used to select an element or to close window' if not self.drawn: return char = evt.char if char in '1 2 3 4 5 6 7 8 9 0'.split(' '): if self.selecting: dprint('selecting because copied') dprint(self.recent_value) self.dict[int(char)] = self.recent_value self.drawn, self.selecting = False, False self.root.withdraw() self.update_listbox() return self.drawn, self.selecting = False, False #Close window self.root.withdraw() dprint(char) text = self.dict[int(char)] #Type selected text pyautogui.typewrite(text) elif evt.keysym == 'space': return else: return dprint(char) dprint(evt.keysym) dprint('bye') self.root.withdraw() self.drawn, self.selecting = False,False return
def resetKeysPressed(self, keysPressed="", cancelKeyStrokes=False): if cancelKeyStrokes: backspaces = [] for x in range(0, len(self.keysPressed)): backspaces.append("backspace") pyautogui.typewrite(backspaces) self.keysPressed = keysPressed
def key(s): if 'enter' in s: pyautogui.press('enter') elif 'back' in s: pyautogui.press('back') else: pyautogui.typewrite(s)
def printscores(): #note only works in Firefox #selects all of the scores try: selectall = WebDriverWait(browser, 3).until(EC.presence_of_element_located((By.ID, "m_m_mid_mid_ReportByDate2_rptDataView_ctl00_ctl02_ctl01_GridClientSelectColumnSelectCheckBox"))) selectall.click() except: pass #exports to pdf export = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "m_m_top_wel_imgBtnExport"))) export.click() logging.debug("Still working") #chooses pdf from the popup browser.switch_to.frame('rwPreview') choosepdf = WebDriverWait(browser, 2).until(EC.presence_of_element_located((By.ID, "radio4"))) choosepdf.click() donebutton = browser.find_element_by_id('imgBtnDone') donebutton.click() #todo let it continue when the pdf downloads and break if it does not download time.sleep(5) pyautogui.press('enter') time.sleep(2) pyautogui.hotkey('ctrl', 'j') time.sleep(2) pyautogui.press('enter') time.sleep(4) pyautogui.hotkey('ctrl', 'p') time.sleep(4) pyautogui.press('enter') time.sleep(4) pyautogui.typewrite(printcode) pyautogui.press('enter')
def parse_info(name): driver.find_element_by_xpath('//*[@title="Search or start new chat"]').click() pag.typewrite(name) pag.press('enter') time.sleep(1) page = driver.page_source soup = BeautifulSoup(page, "html.parser") x = soup.find_all("span") numbers = [] for i in range(0,len(list(x))): if str(x[i]).find(str(name)) == -1: continue else: numbers.append(i) del i date = str(datetime.now()) name = re.search('>(.*)<', str(x[numbers[len(numbers)-1]])).group(1) info = re.search('>(.*)<', str(x[numbers[len(numbers)-1]+1])).group(1) del x return date,name,info
def sign_in(email, password): pyautogui.typewrite(email, interval=TYPE_INTERVAL) pyautogui.press('enter') time.sleep(3) pyautogui.typewrite(password, interval=TYPE_INTERVAL) pyautogui.press('enter') time.sleep(3)
def main(rfid_reader = default_rfid_reader_port): print "Connecting to Sparkfun RFID reader on port ", rfid_reader try: ser = serial.Serial(rfid_reader, timeout=1) # connect to the rfid reader print "Successfully connected to RFID reader on ", rfid_reader rfid_reader_opened = 1 except: print "Failed to connect to RFID reader on port ", rfid_reader rfid_reader_opened = 0 # if the RFID reader was successfully connected, start reading and processing tags if rfid_reader_opened: while 1: # loop forever ser.flushInput() # flush any extra data from the serial port rfid_data = ser.readline().strip() # read the rfid data # if data has been received if len(rfid_data) > 0: rfid_data = rfid_data[1:13] # strip off all data but the tag number print "Tag data:", rfid_data # print the tag number to console pyautogui.typewrite(rfid_data) # auto-type the tag number to focus window pyautogui.typewrite(['tab']) # auto-type a tab to the focus window to move to the next field
def run(self): while 1: try: data = record_keyboard_data() pyautogui.typewrite(data) pyautogui.press('enter') except Exception as e: print "Something went wrong in keyboardThread: ", e
def loadSymbolInChart(msComponents, symbol): pyautogui.moveTo(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'], 0.25) safeClick(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y']) pyautogui.hotkey(platform.primary_key_modifier, 'a') pyautogui.press('delete') pyautogui.typewrite(symbol) pyautogui.typewrite(['enter']) wait(DELAY_CHART_LOAD)
def Tu_Dong_Go_Phim(): time.sleep(2) i = 0 while i < 10: i += 1 keyDown('enter', pause=0.25) keyUp('enter', pause=0.25) typewrite(str(i), interval=0.5)
def bet(self, n): v = self.LOCATIONS['textBar'] gui.moveTo(np.random.randint(v[0][0] + self.x, v[1][0] + self.x), np.random.randint(v[0][1] + self.y, v[1][1] + self.y), duration = .5) gui.click() gui.typewrite(str(n), interval=0.25) gui.press('enter')
def quickbooks(self): ''' Starts QuickBooks. Logs in. ''' startfile('"C:\Program Files (x86)\Intuit\QuickBooks Enterprise Solutions 16.0\QBW32Enterprise.exe"') sleep(30) typewrite(self.password) press('enter') sleep(5)
def my_script(image,drawable,text_value,int_value): # pdb.gimp_message( "Hello from python") gimp.set_foreground(50,0,150) pdb.gimp_context_set_brush('Oils 01') gui.typewrite('p') # open brush gui.moveTo(500,500) gui.dragTo(550,550,.1) return
def typeAndSave(self, msg): """ A matching keystroke is sent for each character in msg. Afterwards, ctrl+s is sent. """ keys = list(msg) + ["enter"] pyautogui.typewrite(keys, interval=0.05) pyautogui.hotkey("ctrl", "s") time.sleep(1)
def genericSpammer(quantity, msg): try: pyautogui.FAILSAFE = True for i in range(quantity): pyautogui.typewrite(msg, interval=0.001) pyautogui.press('enter') except pyautogui.FailSafeException as e: raise e
def openApp(self,name): sleep(1) old_apps = get_window_infos() print("old_apps:%s" % old_apps) #打开launcher,输入appName pyautogui.press('winleft') sleep(1) if get_active_window_name() == "dde-launcher": pyautogui.typewrite(name,interval=0.1) else: log.info("launcher does not opened!") sys.exit(1) sleep(1) pyautogui.press('enter') if name in ("driver-manager", "gparted","deepin-boot-maker"): self.input_passwd() start = datetime.now() if Window(display.Display()).loop(): end = datetime.now() sleep(2) new_apps = get_window_infos() if (len(new_apps) > len(old_apps)): new_app = list(set(new_apps).difference(set(old_apps))) new_app = new_app[0].split(" ") new_app_xid = new_app[0] new_app_name = new_app[1] newApp = AppAction(new_app_xid,name,self) else: log.info("app does not opened!") sys.exit(1) else: start = datetime.now() if Window(display.Display()).loop(): end = datetime.now() sleep(2) new_apps = get_window_infos() if (len(new_apps) > len(old_apps)): new_apps = get_window_infos() new_app = list(set(new_apps).difference(set(old_apps))) new_app = new_app[0].split(" ") new_app_xid = new_app[0] new_app_name = new_app[1] newApp = AppAction(new_app_xid,name,self) else: log.info("app does not opened!") sys.exit(1) end = datetime.now() openedTime = (end-start).seconds+(end-start).microseconds/1000000.0 log.info("openWindow %s in %f seconds"% (name,openedTime)) return newApp
def gmail(self): ''' Starts Firefox. Navigates to Gmail. ''' startfile(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe') sleep(5) hotkey('ctrl','l') sleep(2) typewrite('www.gmail.com') press('enter') sleep(2)
def freq2words(add, tags, stuff, source): #declare the word so it's easier to sort word = text[int(stuff[0])%len(text)] # Handle the full stop # if there's a full stop, strip it out and replace it with a genuine keystroke if '.' in word: keyboard.type_string('.') else: #if there's not, send it out to the keyboard print ('nfs') pyautogui.typewrite(word+' ')
def callnumber(number): callsetup() pyautogui.typewrite(number, interval=TYPE_INTERVAL) # type with quarter-second pause in between each key # pyautogui.press('enter') time.sleep(1) location = pyautogui.locateOnScreen(image('call-button.png')) if location is None: print 'Could not find call button' return False location_x, location_y = pyautogui.center(location) pyautogui.click(location_x, location_y) time.sleep(1)
def start(): "function to automatically start trade tiger" pyautogui.moveTo(0,765) #move to start button pyautogui.click() pyautogui.moveTo(100,76) time.sleep(1) #pyautogui.scroll(-300) pyautogui.typewrite('trade') time.sleep(2) pyautogui.click(1155,267) #pyautogui.PAUSE time.sleep(15)
def play(): pyautogui.hotkey('winleft', '9') time.sleep(0.5) pyautogui.hotkey('ctrl', 't') pyautogui.typewrite('http://www.kanyezone.com/', interval = 0.05) pyautogui.press('enter') time.sleep(4) # pyautogui.press('enter') pyautogui.keyDown('right') time.sleep(0.25) pyautogui.keyUp('right') tick()
def open_shell(command=False): run_command('termite') if command: sleep(delays['program_open']) if isinstance(command, list): for c in command: pag.typewrite(c) pag.press('enter') sleep(0.1) else: pag.typewrite(command) pag.press('enter')
def autoType(self): r = tkMessageBox.askquestion(u'注意!', u'請確定已經切換至中文輸入,且大寫鎖為解除的狀態!', icon='warning') if r == 'yes': os = platform.system() if os == 'Darwin': subprocess.call(['open', '-a', 'Notes']) time.sleep(1) pyautogui.typewrite(self.entryVariable.get())
def typewait(typevalue, delay, typeinterval): pyautogui.typewrite(typevalue, interval=typeinterval) sleep(delay)
def site_work(): #explorer pyautogui.hotkey("win", "r") time.sleep(2) pyautogui.hotkey("ctrl", "a") pyautogui.typewrite(r"explorer.exe D:\Aiactive\B-A-H-E-R") pyautogui.typewrite(["enter"]) time.sleep(time_delay("explorer.exe")) time.sleep(2) #pyautogui.hotkey("win", "right") #chrome pyautogui.hotkey("win", "r") time.sleep(2) pyautogui.hotkey("ctrl", "a") pyautogui.typewrite(r"chrome.exe") pyautogui.typewrite(["enter"]) time.sleep(time_delay("chrome.exe")) time.sleep(2) #pyautogui.hotkey("win", "left") #Command prompt pyautogui.hotkey("win", "r") time.sleep(2) pyautogui.hotkey("ctrl", "a") pyautogui.typewrite("cmd") pyautogui.typewrite(["enter"])
import pyautogui as pag # importing pyautogui with the keyword "pag" so that we wouldn't need to enter such a lengthy name again and again import time # importing the package called time msg = "Subscribe to VirtualThug9!" # creating a variable to spam time.sleep(5) # making the code pause for a few secs (5 secs in my case) while True: # creating an infinte loop; this is infinite because True is always == True. So, there is no condition to set True == False pag.typewrite(msg) # typing where our cursor is using pyautogui pag.press("enter") # pressing the key "enter" using pyautogui
import pyautogui as pg import time pg.hotkey('ctrl', 'winleft', 'd') pg.hotkey('winleft') pg.typewrite('chrome\n', .3) pg.hotkey('winleft', 'up') pg.typewrite('dannydavito\n', .3) time.sleep(2) pg.moveTo(48, 217) pg.click()
# 0. 引入所需要使用的套件,並初始化 #### 我要 pyautogui 並且指令間隔為 1 秒 import pyautogui pyautogui.PAUSE = 0.5 #### 我還要 sleep function #### 等待就是睡覺 from time import sleep # 1. 打開小畫家 pyautogui.hotkey('win', 'r') pyautogui.typewrite('mspaint') pyautogui.press('enter') # 或許需要忍一下,睡 3.21 秒 sleep(0.71) pyautogui.hotkey('win', 'up') # 最大化 # 2. 畫六文錢 #### 一文錢畫六次,但要畫在正確的大小跟地方 # 2.0 先準備畫 一文錢的 function ##### 左上角 (x, y) 長寬 size def ichimonsen(x, y, size): # 先畫一文錢的圓 ## 選到圓 (橢圓) pyautogui.click(423, 65) ### 拉一個圓 pyautogui.moveTo(x, y) pyautogui.dragRel(size, size, 0.3)
import pyautogui, sleep time.sleep(5) f = open("lyrics" , 'r') for word in f: pyautogui.typewrite(word) pyautogui.press("enter")
import pyautogui import time import os time.sleep(1) access_file = open('access.txt', 'r') access = access_file.read() if access == "True": # Put your password here. pyautogui.typewrite('Your Password Here') pyautogui.press('enter')
def run_alexa(): command = take_command() if "play" in command: song = command.replace("play", "") talk("playing") print("playing....") pywhatkit.playonyt(song) elif "time" in command: time = datetime.now().strftime("%I:%M %p") talk(f"Now it is {time}") print(f"Now it is {time}") elif "wikipedia" in command: person = command.replace("wikipedia", "") info = wikipedia.summary(person, 5) print(info) talk(info) elif "How are you" in command: talk("I am fine.Thank you.How are you") print("I am fine.Thank you.How are you") if "doing good" or "fine" in command: print("Thats great") talk("Thats great") else: pass elif "joke" in command: talk(pyjokes.get_joke()) elif "open google" in command: webbrowser.open("www.google.com") if "write" in command: pyautogui.typewrite(command) pyautogui.press("enter") else: pass elif "open youtube" in command: webbrowser.open("www.youtube.com") if "write" in command: pyautogui.typewrite(command) pyautogui.press("enter") else: pass elif "music on" in command: music_dir = "F:\\Music\\english" songs = os.listdir(music_dir) print(songs) os.startfile(os.path.join(music_dir, songs[random.randint(0, 29)])) elif "who has made you" in command: talk("My tutor and mentor is Tanvir Rashik Shafim") print("My tutor and mentor is Tanvir Rashik Shafim") elif "your age" in command: date = "17/01/2021" birthday = datetime.strptime(date, "%d/%m/%Y") now = datetime.now() current_time = datetime(now.year, now.month, now.day) Age = (current_time - birthday).days // 365 print(f"I am {Age} years old") elif "Stop" in command: talk("Thank you for using me") Alive = False else: talk("Sorry i didnt understand") talk("Please say it again")
def minute(): if (minutes == 1): pyautogui.typewrite('01') if (minutes == 2): pyautogui.typewrite('02') if (minutes == 3): pyautogui.typewrite('03') if (minutes == 4): pyautogui.typewrite('04') if (minutes == 5): pyautogui.typewrite('05') if (minutes == 6): pyautogui.typewrite('06') if (minutes == 7): pyautogui.typewrite('07') if (minutes == 8): pyautogui.typewrite('08') if (minutes == 9): pyautogui.typewrite('09') else: pyautogui.typewrite(str(minutes))
def __test(): print(getcwd() + "\\shares\\test.jpg") print(gui.position()) gui.click(271, 529) gui.typewrite(getcwd() + "\\shares\\test.jpg") gui.typewrite(["enter"])
time.sleep(2) def locate_reply_box(): reply_box_pos = pyautogui.locateOnScreen('reply_box.png') if reply_box_pos is None: raise Exception("Error: Reply box not found.") reply_box_x = reply_box_pos[0] reply_box_y = reply_box_pos[1] return reply_box_x, reply_box_y while True: time.sleep(1) rx, ry = locate_reply_box() for x in range(rx - 62, rx + 9): for y in range(ry - 16, ry - 47, -1): if pyautogui.pixelMatchesColor(x, y, (255, 255, 255)): pyautogui.moveTo(rx, ry + 24, duration=1) pyautogui.click(rx, ry + 24, button='left') pyautogui.typewrite( "Nice to meet you. Swastik will contact you soon.") pyautogui.press("enter") time.sleep(2)
def TypeTextinTextBox(sentence, btn_locat): pya.typewrite(sentence[0], interval=0.8) time.sleep(1) pya.click(btn_locat[0] - 200, btn_locat[1]) time.sleep(1) pya.typewrite(sentence[1:], interval=0.5)
'C:\\Users\\Adam\\Pictures\\discordSelectedHome.png') # Click on home on discord pyautogui.click(discordHome[0], discordHome[1]) time.sleep(3) # Locate the create DM button on discord. createDM = pyautogui.locateCenterOnScreen( 'C:\\Users\\Adam\\Pictures\\discordCreateDM.png') time.sleep(3) # Click on the create DM button on discord. pyautogui.click(createDM[0], createDM[1]) # Add friends to the group DM on discord. for person in friendsList: person = person.lstrip() pyautogui.typewrite(person) pyautogui.press('enter') # Locate create group DM button on discord. createGroupDM = pyautogui.locateCenterOnScreen( 'C:\\Users\\Adam\\Pictures\\discordCreateGroupDM.png') # Click on the create group DM button on discord. pyautogui.click(createGroupDM[0], createGroupDM[1]) pyautogui.typewrite(message) pyautogui.press('enter')
import serial #Serial imported for Serial communication import time #Required to use delay functions import pyautogui ArduinoSerial = serial.Serial( 'com4', 9600) #Create Serial port object called arduinoSerialData time.sleep(2) #wait for 2 seconds for the communication to get established while 1: incoming = str( ArduinoSerial.readline()) #read the serial data and print it as line print(incoming) if 'PlayStop' in incoming: pyautogui.typewrite(['space'], 0.2) if 'Rewind' in incoming: pyautogui.hotkey('ctrl', 'left') if 'Forward' in incoming: pyautogui.hotkey('ctrl', 'right') if 'Vup' in incoming: pyautogui.hotkey('ctrl', 'down') if 'Vdown' in incoming: pyautogui.hotkey('ctrl', 'up') incoming = ""
def hour(): if (hours == 1): pyautogui.typewrite('01') if (hours == 2): pyautogui.typewrite('02') if (hours == 3): pyautogui.typewrite('03') if (hours == 4): pyautogui.typewrite('04') if (hours == 5): pyautogui.typewrite('05') if (hours == 6): pyautogui.typewrite('06') if (hours == 7): pyautogui.typewrite('07') if (hours == 8): pyautogui.typewrite('08') if (hours == 9): pyautogui.typewrite('09') else: pyautogui.typewrite(str(hours))
from time import sleep import pyautogui sleep(2) #sleep to click into where you want to paste script = open('script.txt','r') lines = script.readlines() for line in lines: #get rid of blank lines if not line.strip(): continue pyautogui.typewrite(line.strip()) pyautogui.press('enter')
@author: PranavM """ import pyautogui width, height = pyautogui.size() "Controlling the Mouse" pyautogui.position() pyautogui.moveTo(10, 10) pyautogui.moveTo(10, 10, duration=5) pyautogui.moveRel(500, 0) #moves the mouse relative to the current position pyautogui.displayMousePosition( ) # to check the position of the mouse at the moment. However, it is better to use it in CMD "Controlling the Keeyboard" pyautogui.click() pyautogui.typewrite(('Hello World')) from tkinter import * root = Tk() topframe = frame(root) topframe.pack() bottomframe = frame(root) bottomframe.pack(side=BOTTOM) button1 = Button(topFrame, text='Button1') root.mainloop()
def programing(): #explorer pyautogui.hotkey("win", "r") time.sleep(2) pyautogui.hotkey("ctrl", "a") pyautogui.typewrite(r"D:\Sources\Python\Projects") pyautogui.typewrite(["enter"]) time.sleep(time_delay("explorer.exe")) time.sleep(2) #pyautogui.hotkey("win", "right") #chrome pyautogui.hotkey("win", "r") time.sleep(2) pyautogui.hotkey("ctrl", "a") pyautogui.typewrite(r"chrome.exe") pyautogui.typewrite(["enter"]) time.sleep(time_delay("chrome.exe")) time.sleep(2) #pyautogui.hotkey("win", "left") #Vs code pyautogui.typewrite(["win"]) time.sleep(2) pyautogui.typewrite("visual studio") time.sleep(5) pyautogui.typewrite(["enter"]) time.sleep(3)
def outlookMail(accno,crow): pyautogui.hotkey('alt','tab') time.sleep(1) pyautogui.hotkey('ctrl','t') time.sleep(1) pyautogui.click(313,50) #urlBarPos pyautogui.typewrite('https://signup.live.com/signup') pyautogui.press('enter') time.sleep(15) pyautogui.click(534,463) pyautogui.typewrite('rahulgandhiscript'+accno) pyautogui.click(797,516) time.sleep(2) pyautogui.typewrite('6A9dX9qtpZYqzG2') pyautogui.click(797,576) time.sleep(2) pyautogui.typewrite('Rahul') pyautogui.press('tab') pyautogui.typewrite('gandhiscript'+accno) pyautogui.click(810,545) time.sleep(2) pyautogui.press('tab') pyautogui.press('down') pyautogui.press('tab') pyautogui.press('down') pyautogui.press('tab') pyautogui.typewrite('1990') time.sleep(1) pyautogui.click(797,570) input("Press a key to proceed ") #time.sleep(30) pyautogui.hotkey('alt','tab') time.sleep(2) pyautogui.hotkey('ctrl','w') time.sleep(1) pyautogui.hotkey('ctrl','t') time.sleep(2) pyautogui.click(313,50) #urlBarPos pyautogui.typewrite('http://outlook.com/') pyautogui.press('enter') time.sleep(15) pyautogui.click(954,519) time.sleep(2) pyautogui.click(954,519) time.sleep(2) pyautogui.click(952,411) time.sleep(2) pyautogui.click(952,411) time.sleep(2) pyautogui.click(952,411) time.sleep(2) pyautogui.click(952,411) time.sleep(2) pyautogui.click(955,516) time.sleep(15) pyautogui.click(681,563) time.sleep(2) pyautogui.click(1028,196) time.sleep(3) # now outlook mail is logined and setup pyautogui.hotkey('ctrl','t') # Lets create a github account time.sleep(2) pyautogui.click(313,50) #urlBarPos pyautogui.typewrite('https://github.com/') pyautogui.press('enter') time.sleep(5) pyautogui.click(1257,136) time.sleep(4) pyautogui.typewrite('rahulgandhiscript'+accno) pyautogui.press('tab') pyautogui.typewrite('rahulgandhiscript'+accno+'@outlook.com') pyautogui.press('tab') pyautogui.typewrite('6A9dX9qtpZYqzG2') input("Press a key to proceed ") # Do fill the captcha and proceed next to two pages till it # asks for verify the email address pyautogui.hotkey('alt','tab') time.sleep(2) pyautogui.hotkey('ctrl','shift','tab') pyautogui.press('f5') time.sleep(6) # Wait to load inbox pyautogui.click(90,570) # Junk Email time.sleep(4) pyautogui.click(330,353) # email click time.sleep(2) pyautogui.click(745,611) # Verify button click time.sleep(3) print('Account Created Successfully') pyautogui.click(1326,135) time.sleep(2) pyautogui.click(1189,516) # Github Logout time.sleep(2) pyautogui.hotkey('ctrl','w') time.sleep(2) #pyautogui.click(1137,127) # Bug in line # 16 tabs to go i = 0 while i < 16: pyautogui.press('tab') time.sleep(0.5) i = i + 1 time.sleep(2) pyautogui.click(1094,388) # Logout button time.sleep(2) pyautogui.hotkey('ctrl','w') time.sleep(2) pyautogui.hotkey('ctrl','w') time.sleep(2) print("Task Completed")
def cadastroItem(is_SINAPI, primeiraVez, codigo, descricao, unidade, precoUnitario, bdi, quantidades): time.sleep(2) pyautogui.PAUSE = time0 if primeiraVez == 1: pyautogui.keyDown('alt') pyautogui.hotkey('tab') pyautogui.keyUp('alt') #pyautogui.confirm('Prosseguir0') pyautogui.hotkey('tab') pyautogui.hotkey('enter') pyautogui.PAUSE = 2 #image = pyautogui.locateOnScreen('detect_my_job1.png') #while image != None: # print('prosseguir 1') # image = pyautogui.locateOnScreen('detect_my_job.png') time.sleep(2) #im = pyautogui.screenshot('test1-1.png', region=(660,560, 80, 40)) #im = pyautogui.screenshot('test1-1-trabalho.png', region=(670,490, 80, 30)) im = pyautogui.screenshot('test1-1-trabalho.png', region=(670, 460, 80, 30)) imgplot = plt.imshow(im) plt.show() im2 = Image.open("aguarde_trabalho.png") equalImages = equals(im, im2) print(equalImages) while equalImages == True: im = pyautogui.screenshot('test1-2-trabalho.png', region=(670, 460, 80, 30)) equalImages = equals(im, im2) print('cadastro item stop 1') #pyautogui.confirm('Prosseguir1') #pyautogui.PAUSE = time2 pyautogui.hotkey('right') pyautogui.PAUSE = 2 im = pyautogui.screenshot('test2-1-trabalho.png', region=(670, 490, 80, 30)) equalImages = equals(im, im2) while equalImages == True: im = pyautogui.screenshot('test.png', region=(670, 490, 80, 30)) equalImages = equals(im, im2) print('cadastro item stop 2') #pyautogui.confirm('Prosseguir2') pyautogui.hotkey('tab') pyautogui.PAUSE = time0 #pyautogui.hotkey('down') pyautogui.typewrite(str(n_evento), interval=0.001) if n_evento >= 10: time.sleep(3) pyautogui.typewrite(str(n_evento), interval=0.001) pyautogui.PAUSE = time1 pyautogui.hotkey('tab') pyautogui.PAUSE = 0.25 pyautogui.hotkey('tab') pyautogui.PAUSE = 2 if is_SINAPI == 1: # eh SINAPI pyautogui.hotkey('s') pyautogui.PAUSE = 1 pyautogui.hotkey('tab') pyautogui.hotkey('enter') im = pyautogui.screenshot('test2.png', region=(970, 495, 90, 25)) imgplot = plt.imshow(im) plt.show() imlupapesquisar = Image.open("lupaPesquisar.png") equalImages = equals(im, imlupapesquisar) #while equalImages == False: im = pyautogui.screenshot('test2.png', region=(970, 495, 200, 100)) # equalImages = equals(im, imlupapesquisar) # print(equalImages) #pyautogui.confirm('Prosseguir - clicou na lupa?') pyautogui.hotkey('shift', 'tab') pyautogui.hotkey('left') pyautogui.hotkey('tab') ##pyautogui.keyDown('alt') ##if primeiraVez == 1: ## pyautogui.hotkey('tab') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') #copia e cola o CODIGO ##pyautogui.hotkey('ctrl','c') #copia e cola o CODIGO ##pyautogui.hotkey('right') ##pyautogui.hotkey('right') ##pyautogui.hotkey('right') ##pyautogui.hotkey('right') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = 0.5 pyautogui.typewrite(codigo, interval=0.1) #pyautogui.hotkey('ctrl','v') pyautogui.hotkey('tab') pyautogui.hotkey('enter') pyautogui.PAUSE = 2 time.sleep(3) #pyautogui.confirm('Prosseguir - PRONTO PARA APERTAR ENTER?') pyautogui.hotkey('enter') pyautogui.hotkey('tab') pyautogui.hotkey('tab') pyautogui.hotkey('tab') pyautogui.hotkey('enter') pyautogui.PAUSE = 2 #copia e cola o CUSTO UNITÁRIO ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') time.sleep(3) #pyautogui.confirm('Prosseguir - NO EXCEL PRONTO COPIAR CUSTO?') ##pyautogui.hotkey('ctrl','c') #pyautogui.confirm('Prosseguir - COPIOU O CUSTO?') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.typewrite(precoUnitario, interval=0.1) ##pyautogui.hotkey('ctrl','v') if is_SINAPI == 0: #nao eh SINAPI, eh CPOS, SIURB,... pyautogui.hotkey('o') pyautogui.PAUSE = time2 pyautogui.hotkey('tab') pyautogui.PAUSE = 0.25 #copy and paste CODIGO ##pyautogui.keyDown('alt') ##if primeiraVez == 1: ## pyautogui.hotkey('tab') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') ##pyautogui.hotkey('ctrl','c') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = 0.5 #pyautogui.hotkey('tab') #pyautogui.keyDown('alt') #pyautogui.confirm('Prosseguir3 - pronto para colar o codigo') pyautogui.typewrite(codigo, interval=0.1) ##pyautogui.hotkey('ctrl','v') #fim do copia e cola pyautogui.hotkey('tab') #copy and paste #descricao #pyautogui.confirm('Prosseguir3-1 - o codigo deveria ir para o excel e copiar a descricao') pyautogui.PAUSE = 0.25 ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') #pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') ##pyautogui.hotkey('right') ##pyautogui.hotkey('ctrl','c') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') #pyautogui.hotkey('tab') #pyautogui.typewrite( descricao, interval=0.1) xerox.copy(descricao) xerox.paste() pyautogui.hotkey('ctrl', 'v') #fim do copia e cola #pyautogui.hotkey('tab') #copia e cola a UNIDADE ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') ##pyautogui.hotkey('right') ##pyautogui.hotkey('ctrl','c') #OBS: criar mecanismo para analisar termo copiado ##win32clipboard.OpenClipboard() ##unidade = win32clipboard.GetClipboardData() ##print(unidade) ##win32clipboard.CloseClipboard() #pyautogui.confirm('Prosseguir3-1-1 - copiou a unidade?') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = 2 pyautogui.hotkey('tab') pyautogui.hotkey('space') pyautogui.typewrite(unidade, interval=0.1) #pyautogui.confirm('Prosseguir3-2 - tudo certo com a unidade?') pyautogui.PAUSE = 1 #UNIDADE #pyautogui.confirm('Prosseguir3-2 COLOCAR UNIDADE') #pyautogui.typewrite(unidade, interval=0.1) pyautogui.hotkey('tab') #copy and paste #custo referencia pyautogui.PAUSE = 0.25 ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = 0.25 #pyautogui.hotkey('right') ##pyautogui.hotkey('right') ##pyautogui.hotkey('right') ##pyautogui.hotkey('ctrl','c') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = time1 #pyautogui.hotkey('tab') pyautogui.typewrite(precoUnitario, interval=0.1) ##pyautogui.hotkey('ctrl','v') #fim do copia e cola pyautogui.hotkey('tab') #custo unitario ##pyautogui.hotkey('ctrl','v') pyautogui.typewrite(precoUnitario, interval=0.1) #COMUM PARA TANTO SINAPI COMO PARA AS OUTRAS TABELAS pyautogui.PAUSE = 1 pyautogui.hotkey('tab') #pyperclip.copy(bdi) #pyperclip.paste() xerox.copy(bdi) pyautogui.hotkey('ctrl', 'v') #pyautogui.typewrite( bdi, interval=1) pyautogui.PAUSE = 0.25 #com eventos pyautogui.hotkey('tab') #pyautogui.hotkey('down') pyautogui.typewrite(str(n_evento), interval=0.1) #fim com eventos #copy and paste #quantidade (COM EVENTOS) pyautogui.PAUSE = 0.25 pyautogui.hotkey('tab') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') pyautogui.PAUSE = 0.25 #pyautogui.hotkey('left') antes pegava da propria PO ##pyautogui.hotkey('ctrl','pagedown') #muda para a aba CALCULO ##pyautogui.hotkey('ctrl','c') pyautogui.PAUSE = 1 for x in range(1, n_frentes + 1): #pyautogui.typewrite(quantidades[x-1], interval=0.1) time.sleep(2) xerox.copy(quantidades[x - 1]) pyautogui.hotkey('ctrl', 'v') pyautogui.hotkey('tab') ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') #muda para o excel ##if x != n_frentes+1: ## pyautogui.hotkey('right') ## pyautogui.hotkey('ctrl','c') ## print(x) #if x == (n_frentes): print('aqui') ##pyautogui.hotkey('down') ##for y in range (1, n_frentes+1): #deixa o cursor na primeira frente do proximo item ## pyautogui.hotkey('left') ##pyautogui.hotkey('ctrl', 'pageup') #volta para a aba PO ##pyautogui.hotkey('down') ##pyautogui.hotkey('left') ##pyautogui.hotkey('left') ##pyautogui.hotkey('left') ##pyautogui.hotkey('left') #deixa o cursor no codigo do proximo item na PO ##pyautogui.keyDown('alt') ##pyautogui.hotkey('tab') ##pyautogui.keyUp('alt') #muda para o siconv pyautogui.hotkey('tab') pyautogui.hotkey('tab') pyautogui.hotkey('enter') #aperta salvar no siconv im = pyautogui.screenshot('test1-1-trabalho.png', region=(670, 490, 80, 30)) imgplot = plt.imshow(im) plt.show() im2 = Image.open("aguarde_trabalho.png") equalImages = equals(im, im2) print(equalImages) while equalImages == True: im = pyautogui.screenshot('test1-2-trabalho.png', region=(670, 490, 80, 30)) equalImages = equals(im, im2) print('cadastro item stop 1')
# -*- coding: utf-8 -*- """ Created on Fri Apr 24 18:43:53 2020 @author: Administrator """ import pyautogui import time #pyautogui.moveTo(40, 54, 2) #pyautogui.click(clicks=2, interval=2) pyautogui.moveTo(1179, 116, 1) pyautogui.doubleClick() time.sleep(1) #pyautogui.typewrite('Hello') #pyautogui.typewrite(['enter']) #pyautogui.typewrite(['a','b','c','enter']) pyautogui.typewrite(['abc','enter'])
pyautogui.sleep(12) else: pyautogui.sleep(2) #............................................................................................................................................................ for name in list_of_apps: pyautogui.hotkey('winleft', 'ctrlleft', 'd') pyautogui.sleep(1) pyautogui.press('win') pyautogui.sleep(1) pyautogui.typewrite(name) pyautogui.sleep(1) pyautogui.press('enter') pyautogui.sleep(1) name_timer(name) # name_timer(name) pyautogui.press('win') pyautogui.sleep(1) pyautogui.typewrite('github') pyautogui.sleep(1) pyautogui.press('enter')
import pyautogui as pg import time pg.hotkey('ctrl', 'winleft', 'd') pg.hotkey('winleft') pg.typewrite('chrome\n', 0.5) pg.hotkey('winleft', 'up') pg.typewrite('amazon.com\n', 0.5) time.sleep(4) pg.hotkey('tab') time.sleep(.2) pg.hotkey('tab') time.sleep(.2) pg.hotkey('tab') time.sleep(.2) pg.hotkey('tab') time.sleep(.2) pg.hotkey('tab') time.sleep(.2) pg.typewrite('boosted board\n') time.sleep(.2) pg.moveTo(1032, 590) pg.click() time.sleep(.2) pg.moveTo(1205, 468) pg.click() time.sleep(.2) pg.moveTo(936, 359)
import pyautogui, time # 5 second delay so you have time to go and open up whats app or insta time.sleep(5) # Opening file in read mode f = open("msg.txt", 'r') # For line in file type in the statement and hit enter to send for line in f: pyautogui.typewrite(line) pyautogui.press("enter") # And that's my Python Spam Bot
import pyautogui import serial import time arduino = serial.Serial('com18', 9600) time.sleep(5) while True: hand_position = str(arduino.readline()) if 'both_far' in hand_position: # Start/stop a slideshow pyautogui.typewrite('f5', 0.3) if 'both_near' in hand_position: pyautogui.typewrite('m', 0.3) if 'right_hand_in' in hand_position: pyautogui.hotkey('ctrl', '+') if 'right_hand_out' in hand_position: pyautogui.hotkey('ctrl', '-') if 'left_hand_in' in hand_position: pyautogui.typewrite('right') if 'left_hand_out' in hand_position: pyautogui.typewrite('left') hand_position = ""
def AMPM(): if (hours == 1) or (hours == 2) or (hours == 3) or (hours == 4) or (hours == 5) or (hours == 6) or (hours == 12): pyautogui.typewrite("PM") else: pyautogui.typewrite("AM")
def saveEditVideo(name, log): save() pyautogui.typewrite(name) pyautogui.press('enter') log.write("New appended video has been saved: " + video + "\n")
print("") print("") print("") print("") print("") print("") for i in range(seconds): print(str(seconds - i) + " Seconds remaining before the Tagging Starts.") time.sleep(1) print("Starting the Tagger.") print("Tagger Started") for i in range(0, int(n)): pyautogui.typewrite(msg + '\n') print("Tagger has successfully executed it's given task!") print("") print("") print("") print("Made by Vossem! Join our Discord Server:https://discord.gg/F8znxtX") print("") print("") print("") print("") print("") print("") input("Thanks for using Discord Tagger by Vossem v1.0! Press any key to exit!")
import pyautogui import time for i in range(0, 100): pyautogui.PAUSE = 0 time.sleep(10) pyautogui.typewrite('3') print("Отзываем льва") time.sleep(9) pyautogui.typewrite('3') print("Призываем льва") time.sleep(5) pyautogui.press('4') print("Отправляем льва в атаку") time.sleep(5) pyautogui.press('t') print("Побежали по кругу") time.sleep(300)
def edit_connection_spec2(self): lst = [self.server_name, 'view_server', 'spec_username2', 'domain'] config = [] for i in range(len(lst)): config.append(gc.get_config(lst[i])) max_loc1 = self.image_match('view_icon', 3) if max_loc1 is None: self.log.error('not find view icon to edit connection') return 'not find view icon to edit connection' pag.rightClick(max_loc1) pag.press('down', presses=2, interval=0.1) pag.press('enter') max_loc2 = self.image_match('view_edit', 10) if max_loc2 is None: self.log.error('not find view connection edit window') pag.hotkey('ctrl', 'alt', 'f4') return 'not find view connection edit window' time.sleep(1) pag.click((max_loc2[0] + 300, max_loc2[1] + 100)) pag.hotkey('ctrl', 'a') pag.typewrite(config[0], interval=0.1) # Input spec_server_name pag.press('tab') pag.typewrite(config[1], interval=0.1) # Input view_server pag.click((max_loc2[0] + 300, max_loc2[1] + 285)) # Click the radio button before using predefined user name\ # and password pag.press('tab') pag.typewrite(config[2], interval=0.1) # Input spec_username2 pag.press('tab') # Input spec password for spec user 2 pag.typewrite('+=_,-?', interval=0.1) pag.hotkey('shift', ',') # Input '<' pag.typewrite('>~', interval=0.1) pag.press('tab') pag.typewrite(config[3], interval=0.1) # Input domain time.sleep(1) pag.click(self.image_match('ok', 3)) time.sleep(1) return config[2]
def test_animatorStepIncrement(cartavisInstance, cleanSlate): """ Test that the Animator can be set to different step increment values. """ i = cartavisInstance.getImageViews() a = cartavisInstance.getAnimatorViews() # Load an image i[0].loadFile(os.getcwd() + '/data/N15693D.fits') # Open animator settings _openAnimatorSettings() # Find the step increment spin box and change the step increment to 2 stepIncrement = ImageUtil.locateCenterOnScreen('test_images/stepIncrement.png') pyautogui.click(x=stepIncrement[0]+40, y=stepIncrement[1]) pyautogui.press('delete') pyautogui.typewrite('2') pyautougi.press('return') # Go to the next channel value a[0].setChannel(0) _getNextValue() assert a[0].getChannelIndex() == 2 # Close animator settings _openAnimatorSettings()