def temp(): pyautogui.alert('This displays some text with an OK button.') pyautogui.position() # current mouse x and y pyautogui.onScreen(x, y) # True if x & y are within the screen. pyautogui.PAUSE = 2.5 # Pause 2.5 s pyautogui.dragTo(x, y, duration=num_seconds) # drag mouse to XY pyautogui.dragRel(xOffset, yOffset, duration=num_seconds) # drag mouse relative to its current position pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left') # The button keyword argument can be 'left', 'middle', or 'right'. pyautogui.scroll(amount_to_scroll, x=moveToX, y=moveToY) pyautogui.mouseDown(x=moveToX, y=moveToY, button='left') pyautogui.mouseUp(x=moveToX, y=moveToY, button='left') pyautogui.typewrite('Hello world!\n', interval=secs_between_keys) # useful for entering text, newline is Enter pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys) pyautogui.hotkey('ctrl', 'c') # ctrl-c to copy pyautogui.hotkey('ctrl', 'v') # ctrl-v to paste pyautogui.alert('This displays some text with an OK button.') pyautogui.confirm('This displays text and has an OK and Cancel button.') pyautogui.prompt('This lets the user type in a string and press OK.') pyautogui.screenshot('foo.png') # returns a Pillow/PIL Image object, and saves it to a file pyautogui.locateOnScreen('looksLikeThis.png') pyautogui.locateCenterOnScreen('looksLikeThis.png') # returns center x and y
def pytube_action(): # input url url_youtube = gui.prompt("Masukan URL Youtube") # jika inputan url dicancel if not url_youtube: exit(0) direktori = select_directory() # jika ada, setuju mengunduh ? setuju = gui.confirm("Yakin ingin mengunduh ?") if setuju.upper() == "OK": # jika setuju if direktori: if not direktori.endswith("/") : direktori += "/" unduh_video(url_youtube, direktori) #print(direktori) else: print("Terjadi Kesalan pada direktori") exit(0) else: exit(0)
def delete_record(): today = datetime.datetime.today() today_str = today.strftime("%Y-%m-%d") today_path = os.path.join( 'd:\\JOHN TILLET\\episode_data\\webshelf\\' + today_str) mrn = pya.prompt(text='Enter mrn of record to delete.', title='' , default='') with shelve.open(today_path) as s: try: del s[mrn] except Exception: pya.alert(text="Already deleted!", title="", button="OK") update()
def episode_get_fund_number(): # get fund number fund_number = pyperclip.copy('na') pya.moveTo(646, 545, duration=0.1) pya.dragTo(543, 545, duration=0.1) pya.moveTo(646, 545, duration=0.1) pya.click(button='right') pya.moveTo(692, 392, duration=0.1) pya.click() fund_number = pyperclip.paste() if fund_number == 'na': fund_number = pya.prompt( text='Please enter fund number!', title='Fund Number', default='') return fund_number
def episode_get_fund_name(): # get fund name fund = pyperclip.copy('na') pya.moveTo(696, 508, duration=0.1) pya.dragTo(543, 508, duration=0.1) pya.moveTo(696, 508, duration=0.1) pya.click(button='right') pya.moveTo(717, 579, duration=0.1) pya.click() fund = pyperclip.paste() if 'United' in fund: fund = 'Grand United Corporate Health' if fund == 'na': fund = pya.prompt( text='Please enter Fund name', title='Fund Name', default='') return fund
import clipboard as cb import time import os filepath = '/home/dipayan/Downloads/my_music/' #pre-requisite : web-browser has to be in maximized mode address_bar_x, address_bar_y = 400, 115 #for my screen size and mozilla prompt_box_x, prompt_box_y = 400, 298 #click on address bar gui.click(0, 440) #reset brownser state gui.click(address_bar_x, address_bar_y) #click to select url #copy address to clip-board gui.hotkey('ctrl', 'c') time.sleep(.1) #get address from clip-board url = cb.paste() video = pafy.new(url) try: best_audio = video.getbestaudio() desired_filename = gui.prompt('Enter desired filename...') tmp = best_audio.download(filepath=filepath + desired_filename + '.mp3', quiet=True) gui.alert('Completed Downloading ' + desired_filename + '.mp3 !') except: gui.alert('No audio format available for this URL')
def import_cvs( ): # function used to import an existing csv. the user will have to specify the name or the path of the csv file. filename = pyautogui.prompt("Enter the name/location of the CSV file.") # denoting that these are globally institiated global pos1 global pos2 global pos3 global var global var2 # color map to maap different color for each node in a particular tier color_map = [] t_one = [] t_two = [] t_three = [] # reading from the nodes.txt file file = open(filename + ".txt", "r") for line in file: path = line.split(",") # Get Nodes and Weight node1 = path[0] node2 = path[1] weight_user = path[2] # Assign colors to nodes, nodes in T1 = Red, T2 = Green, T3 = blue col = '' col2 = '' # Note on the UI x ranges from 0.971534 to 1.01547 & y ranges from 1.85451 to 2.01905 - This was before the map so its void now. # Getting the tier so i can display node in a suitable position in Graph interface node1_tier = int(path[3]) node2_tier = int(path[4]) if node1_tier == 1: col = 'red' if node1 not in t_one: t_one.append(node1) elif node1_tier == 2: col = 'green' if node1 not in t_two: t_two.append(node1) else: col = 'blue' if node1 not in t_three: t_three.append(node1) if node2_tier == 1: col2 = 'red' if node2 not in t_one: t_one.append(node2) elif node2_tier == 2: col2 = 'green' if node2 not in t_two: t_two.append(node2) else: col2 = 'blue' if node2 not in t_three: t_three.append(node2) if (path[5] == "South Africa"): node1_y = -29.16895 node1_x = 26.568181 elif (path[5] == "Zimbabwe"): node1_y = -19.329287 node1_x = 30.170774 elif (path[5] == "Congo"): node1_y = -2.479389 node1_x = 23.987360 elif (path[5] == "Mozambique"): node1_y = -18.164121 node1_x = 35.673637 elif (path[5] == "Botswana"): node1_y = -22.773649 node1_x = 24.075226 elif (path[5] == "Malawi"): node1_y = -13.856747 node1_x = 34.092036 elif (path[5] == "Nigeria"): node1_y = 8.648911 node1_x = 7.907745 elif (path[5] == "United Kingdom"): node1_y = 53.108865 node1_x = -1.402979 elif (path[5] == "Algeria"): node1_y = 28.033886 node1_x = 1.659626 elif (path[5] == "Egypt"): node1_y = 27.024681 node1_x = 28.802349 # Converting x and y to latitude and longitude mx, my = m(node1_x, node1_y) if (path[6] == "South Africa"): node2_y = -29.16895 node2_x = 26.568181 elif (path[6] == "Zimbabwe"): node2_y = -19.329287 node2_x = 30.170774 elif (path[6] == "Congo"): node2_y = -2.479389 node2_x = 23.987360 elif (path[6] == "Mozambique"): node2_y = -18.164121 node2_x = 35.673637 elif (path[6] == "Botswana"): node2_y = -22.773649 node2_x = 24.075226 elif (path[6] == "Malawi"): node2_y = -13.856747 node2_x = 34.092036 elif (path[6] == "Nigeria"): node2_y = 8.648911 node2_x = 7.907745 elif (path[6] == "United Kingdom"): node2_y = 53.108865 node2_x = -1.402979 elif (path[6] == "Algeria"): node2_y = 28.033886 node2_x = 1.659626 elif (path[6] == "Egypt"): node2_y = 27.024681 node2_x = 28.802349 # Converting x and y to latitude and longitude mx2, my2 = m(node2_x, node2_y) # Adding nodes, edge and weight to the graph G.add_node(node1, pos=(mx, my), color=col) G.add_node(node2, pos=(mx2, my2), color=col2) G.add_edge(node1, node2, weight=weight_user) pos1 = node1_x + 5.013474 pos2 = node2_x + 5.013474 pos3 = pos3 + 5.013474 file.close # To show weights on graph interface weight = nx.get_edge_attributes(G, 'weight') # getting the position of the nodes the in the form of a dictionary data structure pos = nx.get_node_attributes(G, 'pos') # Statement used to draw the graph and show node labels nx.draw(G, pos, with_labels=True) nx.draw_networkx_nodes(G, pos, with_labels=True, nodelist=t_one, node_color='r', node_shape='o', node_size=1000) nx.draw_networkx_nodes(G, pos, with_labels=True, nodelist=t_two, node_color='g', node_shape='s', node_size=500) nx.draw_networkx_nodes(G, pos, with_labels=True, nodelist=t_three, node_shape='o', node_color='purple') #nx.draw_networkx_edge_labels(G, pos, edge_labels = weight) m.drawcountries(linewidth=1) m.drawstates(linewidth=0.2) m.drawcoastlines(linewidth=1) plt.title("Network Provided to African countries by ISP's.") # m.shaderelief() # plt.tight_layout() plt.show()
import pyautogui as gui gui.alert('This program gives an output based on the range of numbers you provide.') gui.alert('You can change the program for the output you want. This only gives square root.') one = int(gui.prompt('Give first integer: ')) two = int(gui.prompt('Give second integer: ')) for i in range(one, two): print (f'Sqaure root of {i} is {i**1/2}')
# **************** "iNNovationMerge DailyCodeHub" **************** # Visit https://www.innovationmerge.com/ # Theme : GUI Automation using Python # Python program to display prompt box on GUI import pyautogui pyautogui.prompt('is DailyCodeHub Helping you?')
from selenium import webdriver import time import pyautogui import random driver = webdriver.Chrome(r'C:\chromedriver.exe') keyword = pyautogui.prompt(text="해시태그를 입력하세요", title="Message") LOGIN_URL = "https://www.instagram.com/accounts/login/?hl=ko" USER_ID = "아이디" USER_PW = "비밀번호" TAG_URL = f"https://www.instagram.com/explore/tags/{keyword}/?hl=ko" driver.get(LOGIN_URL) time.sleep(3) # 아이디 입력 driver.find_element_by_name("username").send_keys(USER_ID) time.sleep(1) # 패스워드 입력 driver.find_element_by_name("password").send_keys(USER_PW) time.sleep(1) # 로그인버튼 클릭 driver.find_element_by_css_selector( "div.Igw0E.IwRSH.eGOV_._4EzTm.bkEs3.CovQj.jKUp7.DhRcB").click() time.sleep(3)
import requests from bs4 import BeautifulSoup import pyautogui import os import openpyxl keyword = pyautogui.prompt(text="검색어를 입력하세요", title="Message") last_page = int(pyautogui.prompt(text="몇 페이지까지 검색할까요?", title="Message")) cur_page = 1 # 현재 페이지 # 리스트 생성 news_title_list = [] # 뉴스 제목 리스트 news_content_list = [] # 뉴스 본문 리스트 for i in range(1, last_page * 10 + 1, 10): # 1, 11, 21, .... last_page*10 + 1 print(f'========현재 페이지 {cur_page}=========') url = f'https://search.naver.com/search.naver?&where=news&query={keyword}&start={i}' response = requests.get(url) response.raise_for_status() html = response.text soup = BeautifulSoup(html, 'html.parser') headers = soup.select("div.info_group") for header in headers: links = header.select("a.info") if len(links) > 1:
if i in str1: return str1 def quchong(ll): ss = '' for i in ll: if i in ss: continue else: ss = ss + '\n' + i return ss while 1: try: url = pyautogui.prompt('请输入网址:') if not url: break tt = Youku_comment(url) pinglun = tt.aa while 1: kws = pyautogui.prompt('请输入关键词,多个请用空格隔开(直接回车则代表找背景音乐):') kws = kws if kws else 0 ss = [filt1(i, kws) for i in pinglun] ss = [i for i in ss if i] ss = quchong(ss) print('检索结果:\n') print(ss) jixu = pyautogui.confirm( text='是否要继续检索', title='请确认', buttons=['是', '否']) if jixu == '否':
import pyautogui as pg import time import webbrowser points=0 answer = pg.prompt( """ What team do you prefer? a) The Minnesota Vikings b) The Celevland Browns c) I don't like sports """ ) if answer == "a": points +=1 elif answer == "b": points +=2 elif answer == "c": points +=3 answer = pg.prompt( """ What do you sleep in?
import pyautogui as pg import webbrowser as wb show = pg.prompt("what is your favorite show?") if show == "billions": wb.open("https://www.youtube.com/watch?v=mGIpOtncmSM") pg.alert("good choice") elif show == "the office": wb.open("https://www.youtube.com/watch?v=tTT57_YK6Q4") pg.alert("NICE.io") elif show == "Friends": wb.open("https://www.youtube.com/watch?v=LDU_Txk06tM") pg.alert("chanler bing is me hero") elif show == "suits": pg.alert("I am harvey specter") elif show == "vitourias": pg.alert("that is a dank one") elif show == "NFL": pg.alert("what the WWE") else: pg.alert("Your favorite show is " + show) Pokemon = pg.prompt("what is your favorite pokemon?") if Pokemon == "pikachu": wb.open("https://www.youtube.com/watch?v=zz2ZOqmO0KU") pg.alert("good choice") elif Pokemon == "charzard": wb.open("https://www.youtube.com/watch?v=_GaY_Qsf6o8") pg.alert("He is OP")
msg = msg + f'{i + 1}.{checkList[i]}\n{진행상태[i]}\n\n' else: msg = msg + f'{i + 1}.{checkList[i]}\n{진행상태[i]}\n{처리일시[i]}\n{통관진행상태[i]}\n\n' i += 1 return msg checkList = [] 진행상태 = [] #진행상태 prgsStts 처리일시 = [] #처리일시 prcsDttm 통관진행상태 = [] #통관진행상태 csclPrgsStts added_bl = [] MSG_1 = pyautogui.prompt( '비엘번호 입력', '반출체크', '여기 입력하세요', ) if MSG_1 == None: sys.exit() if MSG_1 != None: checkList.append(MSG_1.upper()) MSG_2 = pyautogui.confirm('비엘을 추가하시겠습니까?', buttons=['예', '아니오(조회하기)']) if MSG_2 == None: sys.exit() if MSG_2 == '예': while True: MSG_1 = pyautogui.prompt( '비엘번호 입력', '반출체크(Cancel = 조회하기)',
import pyautogui as pg import time import webbrowser points = 0 #Question goes here answer = pg.prompt( """ Que est-ce que tu aimes faire? a) J'aime me maquiller. b) J'aime jouer au mon chat. c) J'aime voyager. """ ) pg.alert("You chose " + answer) #Answers and points go here if answer== "a": points += 1 elif answer == "b": points += 2 elif answer == "c": points += 3 #Question goes here answer = pg.prompt( """
import win32com.client as wincl import pyautogui as pg import webbrowser as wb speak = wincl.Dispatch("SAPI.SpVoice") speak.Speak("What's your fave food?") answer = pg.prompt("Enter you fave food.") if answer == "chicken nugs": speak.Speak("I love nuggets") elif answer == "ice cream": speak.Speak("thats really cool. Your cool like ice cream") elif answer == "rutabega": speak.Speak("sick nasty") elif answer == "bacon": speak.Speak("Youre not vegan! Oh my gawd you are killing pigs you monster") else: speak.Speak("Your favorite food is" + answer) speak.Speak("What youtuber do you want to watch") video = pg.prompt("Enter your youtuber below.") speak.Speak("Ok lets go find some" + video + "videos on youtube.") wb.open("https://www.youtube.com/results?search_query=" + video)
import pyautogui choice = pyautogui.confirm(text='是否截取全屏', title='confirm', buttons=['OK', 'Cancel']) if choice is 'OK': save = pyautogui.prompt(text='输入截图名称:', title='prompt') im = pyautogui.screenshot(save + '.png') pyautogui.alert(text='截图完毕', title='alert', button='OK') else: pyautogui.alert(text='程序已结束', title='alert', button='OK')
#! python # Script By JB # Written to Auto ShutOff capture in BlackMagic Express - aka Limit Capture in FCP # Open Terminal - 'python script ##<minutes>' - start # start capture, uses screenshot to finish import time import pyautogui #Enter time. ttr_minutes = pyautogui.prompt('Enter Total Run Time in Minutes. Only use whole numbers.') #Convert to Seconds ttr_seconds = int(ttr_minutes)*60 # Start clock for t in range(ttr_seconds,-1,-1): minutes = t / 60 seconds = t % 60 print "%d:%2d" % (minutes,seconds) # Python v2 only time.sleep(1.0) #SCREESHOTS - find and click - end capture OR Grab window and hit 'ESC" key to end. #!! pyautogui.press('esc') button_location = pyautogui.locateOnScreen('capture.png') bx, by = pyautogui.center(button_location)
user_id = "abcdebes" user_pass = "******" user_certificate_pass = "" #-------------------------------------------------------------------------- # Login Session #-------------------------------------------------------------------------- inXASession = win32com.client.DispatchWithEvents("XA_Session.XASession", XASessionEvents) inXASession.ConnectServer(server_addr, server_port) inXASession.Login(user_id, user_pass, user_certificate_pass, server_type, 0) while XASessionEvents.logInState == 0: pythoncom.PumpWaitingMessages() inXAQuery = win32com.client.DispatchWithEvents("XA_DataSet.XAQuery", XAQueryEvents) inXAQuery.LoadFromResFile("C:\\eBEST\\xingAPI\\Res\\t1511.res") aa= pyautogui.prompt(text='', title='종목코드 001~ ' , default='')#UI inXAQuery.SetFieldData('t1511InBlock', 'upcode', 0, aa) inXAQuery.Request(0) while XAQueryEvents.queryState == 0: pythoncom.PumpWaitingMessages() inx =inXAQuery.GetBlockCount('t1511OutBlock') for i in range(inx): gubun = inXAQuery.GetFieldData('t1511OutBlock', 'gubun', i).encode('utf') hname = inXAQuery.GetFieldData('t1511OutBlock', 'hname', i).encode('utf') pricejisu = inXAQuery.GetFieldData('t1511OutBlock', 'pricejisu', i).encode('utf') jniljisu = inXAQuery.GetFieldData('t1511OutBlock', 'jniljisu', i).encode('utf')
import requests from bs4 import BeautifulSoup import pyautogui keyword = pyautogui.prompt(text='검색어를 입력하세요', title='Message') url = f"https://kin.naver.com/search/list.nhn?query={keyword}" response = requests.get(url) response.raise_for_status() html = response.text soup = BeautifulSoup(html, 'html.parser') lists = soup.select('ul.basic1 > li') for li in lists: title = li.select_one('dl > dt > a').text date = li.select_one('dd.txt_inline').text content = li.select_one('dd:nth-child(3)').text print(title, date, content)
import win32com.client as wincl import pyautogui as pg import webbrowser as wb speak = wincl.Dispatch("SAPI.SpVoice") speak.Speak("What is your favorite color?") answer = pg.prompt("Enter your favorite color below.") if answer == "orange": speak.Speak("Wow, my favorite is orange too. We must be related.") elif answer == "blue": speak.Speak("Blue screens make me scared.") else: speak.Speak("Your favorite color is " + answer) speak.Speak("What video would you like to watch?") video = pg.prompt("Enter your video below") speak.Speak("OK, let's look for " + video + " on Youtube.") wb.open("https://www.youtube.com/results?search_query=" + video)
from firebase import firebase import pyautogui import pickle import time firebase = firebase.FirebaseApplication( 'https://sleep-tight-8a6df.firebaseio.com/', None) email = pyautogui.prompt('Email') passw = pyautogui.prompt('Pass') data = {'Name': email, 'RollNo': passw} result = firebase.post('/sleep-tight-8a6df/Students/', data) pyautogui.alert('Please copy and paste the name in prompt') res = pyautogui.prompt(result) pickle.dump(res, open("name", "wb")) id = pickle.load(open("name", "rb")) time.sleep(8) email = firebase.get('/sleep-tight-8a6df/Students/' + str(id), 'Name') confirm = pyautogui.confirm('Is this your Email Id: ' + str(email), buttons=['YES', 'NO']) if str(confirm) == 'YES': pyautogui.alert( 'Now Run test.py using the command given in github README.md file.') else: pyautogui.alert( 'Please copy the error code and raise a issue in the repository by pasting the error and the file name.' )
import win32com.client as wincl import pyautogui as pg import webbrowser as wb speak = wincl.Dispatch("SAPI.SpVoice") speak.Speak("What's your favorite dessert?") answer = pg.prompt("Enter your favorite dessert") if answer == "chocolate mousse": speak.Speak("Wow that sounds good!") elif answer == "coconut cookies": speak.Speak("Ew. Who likes those?") elif answer == "rainbow cake": speak.Speak("Rainbow cake is AMAZING.") else: speak.Speak("Your favorite dessert is " + answer)
import webbrowser import pyautogui as pg videos = ["https://www.youtube.com/watch?v=x0uXVy4fzUA"] music = ["https://www.youtube.com/watch?v=LsoLEjrDogU"] answer = pg.prompt ( """ Which would you like to do? a) watch vines b) listen to music """ ) if answer == "a": for i in videos: webbrowser.open(i) elif answer == "b": for i in music: webbrowser.open(i)
token1 = # removed for security purposes ##dictionary of branch IDs Members = {"*****@*****.**":"58da5eac5891d87ac1c2fe58", "*****@*****.**":"550bf4bc2094ac8b5df163dc", "*****@*****.**":"550fd08951e882750fa5a557", "*****@*****.**":"57f36c796b25693e34822da8", "*****@*****.**":"5a283ea3be6c95d3fb2348ae", "*****@*****.**":"561f84f36d45d07ffc3b4dec", "*****@*****.**":"550aa531b66b3a41f9cbeb50", "*****@*****.**":"5a1d98407eb93a0ddf5a0867", "*****@*****.**":"550bdfdcab34abe24a3e15f2", "*****@*****.**":"5c3711bcd127c4444bd74167", "*****@*****.**":"5c98854c0ca5cd64c112fd47"} ##dictionary of list IDs myList = {"To Do":"55042f9dd8eec487931646ea", "Doing":"55042fa1c1beafd66acdf60f", "Done":"58163ee99eb2ae47a2be5e85"} ##request trallo card name and due date from user Name = pyautogui.prompt(text='Transfer name?', title='Card Name', default='') dueDate = pyautogui.prompt(text='Due Date?', title='Due Date', default='YYYY-MM-DD') url = "https://api.trello.com/1/cards" ##main loop to add cards with given details for selected branches for x in Branches: querystring = {"name":Name,"due":dueDate,"idList":myList["To Do"],"idMembers":Members[str(x)],"keepFromSource":"all","key":key1,"token":token1} response = requests.request("POST", url, params=querystring)
def duplicate_remover(): # folder, main_xlsx, sheets_number = 1 main_xlsx = pyautogui.prompt('the main xlsx file') filelist = os.listdir() for _ in range(2): main_xlsx = find_file_helper(filelist, main_xlsx) if main_xlsx is None: main_xlsx = pyautogui.prompt( 'file not found, please retype the name') sheets_number = int(pyautogui.prompt('please specify which sheet to use')) sheets_number -= 1 if main_xlsx[-4:] == "xlsx": try: main_wb = openpyxl.load_workbook(main_xlsx) # folder + except: pyautogui.alert( 'Error: File not found, are we looking at the right folder?') main_ws = main_wb[main_wb.sheetnames[sheets_number]] # debug print("xlsx file imported") elif main_xlsx[-4:] == ".xls": try: main_wb = open_xls_as_xlsx(main_xlsx, sheets_number) # folder + except: pyautogui.alert( 'Error: File not found, are we looking at the right folder?') # because in this case it is converted, it has only the first sheet main_ws = main_wb[main_wb.sheetnames[0]] # debug print("xls file imported") header = get_header(main_ws) Partnumber_col = header.index("partnumber") + 1 # debug # print(Partnumber_col) # debug # parts = get_cell_in_partNumber(main_ws, Partnumber_col) # print(parts) label_rows(main_ws, Partnumber_col) #, folder ''' option 1: name output file with user input ''' # saveTo = pyautogui.prompt('process completed, please name the output file') # if .xls in saveTo: # saveTo = saveTo.split(".")[0] + "xlsx" # else: # saveTo += "xlsx" # main_wb.save(saveTo) # command = "start excel " + saveTo ''' option 2: name output file with date ''' # import datetime # currentDT = datetime.datetime.now() # saveTo = "labelled_result_" + str(currentDT.month) + "_" + str(currentDT.day) + ".xlsx" # main_wb.save(saveTo) # command = "start excel " + saveTo ''' option 3: name output file with fixed name ''' main_wb.save('labelled_result.xlsx') command = 'start excel labelled_result.xlsx' os.system(command)
# ============================= import required modules ========================================= import smtplib import time import requests import pyautogui from selenium import webdriver from selenium.webdriver.common.keys import Keys # ============================ using API to fetch data (openweathermap.org) ====================== user_api = pyautogui.prompt("Enter API token") location = pyautogui.prompt("Enter Location Here ") api_link = "https://api.openweathermap.org/data/2.5/weather?q=" + location + "&appid=" + user_api # ============================= sending information via email ID & whatsapp ====================== your_email = pyautogui.prompt("Enter Your Email Address") your_pwd = pyautogui.prompt("Enter Your Password") target_email = ['target_email-1', 'ptarget_email-2', '........'] whats_no = [911234567890, 912131415161, 919089786756] # number should be in int # ============================== retrieving data ================================================ api = requests.get(api_link) api_json_data = api.json() #===================================== WEATHER ================================================
from urllib.request import urlopen from urllib.parse import quote_plus from bs4 import BeautifulSoup from selenium import webdriver import time import tkinter from tkinter import filedialog import pyautogui baseURL = 'https://www.instagram.com/explore/tags/' plusURL = pyautogui.prompt("검색할 태그를 입력해 주세요.") root = tkinter.Tk() root.withdraw() folder = tkinter.filedialog.askdirectory(parent=root, initialdir="/", title="Select Folder") URL = baseURL + quote_plus(plusURL) driver = webdriver.Chrome() driver.get(URL) time.sleep(3) html = driver.page_source soup = BeautifulSoup(html) insta = soup.select('.v1Nh3.kIKUG._bz0w') print(insta[0])
import random import time pyautogui.FAILSAFE = True down_scroll = -7.3 #滚动距离 argv_height = 51 #公众号选中后高度 step = argv_height #每次向下移动 page_height = 523 #页面底部距X轴的高度 line_height = 33 #每组距下一条线高度 startX = 180 #起始位置X startY = 156 #起始位置Y import time import pytesseract from PIL import Image, ImageGrab, ImageEnhance, ImageFilter start = time.perf_counter() total = pyautogui.prompt("输入公众号总数") total = eval(total) # print(total) # #起点位置 # p = { # "x": 30, # "y": 200 # } # pyautogui.click(**p) #公众号位置 # pos = pyautogui.locateOnScreen("./gzh_btn.png") # if pos is None: # pyautogui.alert('无法识别公众号按钮') # exit() # p = {
import pyautogui as pg import time import webbrowser points = 0 # Question answer = pg.prompt(""" Which would you rather do? a) Read Macbeth b) Watch Netlix c) Watch harry potter movies """) # Answer pg.alert("You chose " + answer) if answer == "a": points += 3 elif answer == "b": points += 2 elif answer == "c": points += 1 # Question answer = pg.prompt(""" Who is your role model? a) Macbeth b) Steve Jobs
import pyautogui as pg import time import webbrowser points = 0 # Question answer = pg.prompt(""" Which would you rather do? a) Eat beets and watch battlestar galactica b) Eat as many M&Ms as humanly possible c) Finish producing Threat Level Midnight """) # Give points if answer == "a": points += 1 elif answer == "b": points += 2 elif answer == "c": points += 3 # Question answer = pg.prompt(""" What is your greatest achievement? a) Earning my green belt from sensei b) Playing in my band
def __init__(self): self.__cnpj = pyg.prompt( 'Digite o Nº do CNPJ que você deseja consultar (14 dígitos, sem (. / ou -)' )
def runner(*args): try: message = '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'No sedation': message += 'No sedation.' asa = gnc.ASA_DIC[asa] upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' colon = gnc.COLON_DIC[colon] banding = ba.get() if banding == 'Banding of haemorrhoids': message += ' Banding haemorrhoids.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] formal_message = mes.get() if formal_message: message += formal_message + '.' op_time = ot.get() op_time = int(op_time) (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException pya.click(50, 450) while True: if not pya.pixelMatchesColor(150, 630, (255, 0, 0)): pya.alert(text='Patient file not open??') raise BillingException else: break mrn, name = front_scrape() shelver(mrn, in_theatre, out_theatre, anaesthetist, endoscopist, asa, upper, colon, banding, nurse, clips, varix_lot, message) # web page with jinja2 message = message_parse(message) # break message into lines today_path = episode_to_csv( out_theatre, endoscopist, anaesthetist, name,consult, upper, colon, message, in_theatre, nurse, asa, banding, varix_lot, mrn) make_web_secretary(today_path) make_long_web_secretary(today_path) to_watched() time.sleep(2) close_out(anaesthetist) except BillingException: return asc.set('1') up.set('None') co.set('None') ba.set('None') cl.set('0') con.set('None') mes.set('') ot.set('20')
import pyautogui import os time = pyautogui.prompt( text="Lütfen kaç saniye içerisinde kapanacağını giriniz", title="Hasario") os.system("shutdown /s /t %s " % time)
import pyautogui,time loop = True delay = pyautogui.prompt('Enter delay time') while loop: loop = False name = pyautogui.prompt('Enter file name') dim1 = pyautogui.prompt('x dimension') dim2 = pyautogui.prompt('y dimension') time.sleep(float(delay)) position = pyautogui.position() print(position) im = pyautogui.screenshot(region=(position + (dim1,dim2))) name = str(position[0])+ str(position[1]) + name im.save(name) if pyautogui.confirm('Again?') == 'OK': loop = True
def send_message(): message = pya.prompt(text='Enter your message', title='Message', default='') today_path = message_to_csv(message) make_web_secretary(today_path)
def runner(*args): message = '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'None': message += 'No sedation.' asa = gnc.ASA_DIC[asa] asc.set('1') upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': varix_flag = True message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_flag = False varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] up.set('None') colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' if colon == 'Colon - Govt FOB screening': message += 'Bill 32088-00.' if colon == 'Colon with polyp - Govt FOB screening': message += 'Bill 32089-00.' colon = gnc.COLON_DIC[colon] co.set('None') banding = ba.get() if banding == 'Banding of haemorrhoids.': message += ' Banding haemorrhoids' if consultant == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if consultant == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] ba.set('None') clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] con.set('None') formal_message = mes.get() if formal_message: message += formal_message + '.' mes.set('') op_time = ot.get() op_time = int(op_time) ot.set('20') fund = fu.get() fu.set('') (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException in_data = (anaesthetist, endoscopist, nurse, asa, upper, colon, banding, clips, consult, message, op_time, fund, in_theatre, out_theatre, varix_flag, varix_lot) print(in_data)
from Mouvement import Mouvements oldx,oldy=pyautogui.position() mouv=False tab=[] while True: x,y=pyautogui.position() if (not mouv) and (x!=oldx or y!=oldy): mouv=True; tab=[] print "reset" if mouv: if(x==oldx and y==oldy): mouv=False allFinger=[] allFinger.append(tab) print allFinger mouvement=Mouvements(allFinger) if(pyautogui.confirm("voulez vous sauvegarder?")=="OK"): mouvement.save_to_file(pyautogui.prompt("nom du fichier?")) break oldx,oldy=pyautogui.position() #mouvement.save_to_file("mouvSouris") #mouvement.save_to_svg("mouvSouris.svg") else: tab.append((x,y)) oldx=x oldy=y time.sleep(0.03)
def front_scrape(): def get_title(): pya.hotkey('alt', 't') title = pyperclip.copy('na') pya.moveTo(190, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() title = pyperclip.paste() return title pya.click(50, 450) title = get_title() if title == 'na': pya.press('alt') pya.press('b') pya.press('c') # pya.press('down') # pya.press('enter') title = get_title() if title == 'na': pya.alert('Error reading Blue Chip.') raise BillingException for i in range(4): first_name = pyperclip.copy('na') pya.moveTo(290, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() first_name = pyperclip.paste() if first_name != 'na': break if first_name == 'na': first_name = pya.prompt(text='Please enter patient first name', title='First Name', default='') for i in range(4): last_name = pyperclip.copy('na') pya.moveTo(450, 135, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() last_name = pyperclip.paste() if last_name != 'na': break if last_name == 'na': last_name = pya.prompt(text='Please enter patient surname', title='Surame', default='') print_name = title + ' ' + first_name + ' ' + last_name mrn = pyperclip.copy('na') pya.moveTo(570, 250, duration=0.1) pya.dragTo(535, 250, duration=0.1) pya.moveTo(570, 250, duration=0.1) pya.click(button='right') pya.moveRel(55, 65) pya.click() mrn = pyperclip.paste() if not mrn.isdigit(): mrn = pya.prompt("Please enter this patient's MRN") return (mrn, print_name)
import pyautogui as pg import time import webbrowser points = 0 answer = pg.prompt( """ Which would you rather do? a) Sketch b) Read a book c) Write a public speaking piece d) Surf the internet for sports videos """ ) if answer == "a": points +=1 elif answer == "b": points +=2 elif answer == "c": points +=3 elif answer == "d": points +=4 answer = pg.prompt( """ What is your favorite place? a) Art studio b) Library c) Theater
import webbrowser as wb import pyautogui as pg points = 0 show = pg.prompt("What is your favorite TV show? ") if show == "Hannah Montana": pg.alert("OMG LOL xD ;P") points += .000002032000012 wb.open("https://www.youtube.com/watch?v=s9q61m7S9yA") elif show == "Happy Tree Friends": pg.alert("I love how much gore is in that show!") points -= .000000000000009 wb.open("https://youtu.be/dfTPlsIq7d0?t=327") elif show == "Dance Moms": pg.prompt(" ") pg.alert("OMG lol Jip Clarkes favorite too") points += .120000000000000000 wb.open("https://www.youtube.com/watch?v=LEtorWba_Fg") elif show == "The Office": wb.open("https://www.youtube.com/watch?v=PIQqKsY63xQ") elif show == "Family Guy": wb.open("https://www.youtube.com/watch?v=9mjg9qEBfXs") elif show == "Elmo": wb.open("https://www.youtube.com/watch?v=jzWcLBQGi-0") else: pg.alert("Your favorite show is " + show) points += .3777777777779999028323 wb.open("https://youtu.be/kOTRybt4wQQ?t=35") dance = pg.prompt("Whats your favorite fortnite dance?")
import pyautogui as pg import time import webbrowser points = 0 # Question 1 answer = pg.prompt(""" How would you like to spend your day? a)Relaxing b)Outside (hiking, biking, etc.) c)Sight seeing """) # Give points if answer == "a": points += 1 elif answer == "b": points += 2 elif answer == "c": points += 3 # Question 2 answer = pg.prompt(""" What do you like to do on the weekends? a)Stay home
def runner(*args): try: insur_code, fund, ref, fund_number, message = '', '', '','', '' anaesthetist = an.get() endoscopist = end.get() nurse = nur.get() asa = asc.get() if asa == 'No Sedation': message += 'No sedation.' asa = gnc.ASA_DIC[asa] upper = up.get() if upper == 'Cancelled': message += 'Upper cancelled.' if upper == 'Pe with varix banding': message += 'Bill varix bander.' varix_lot = pya.prompt(text='Enter the varix bander lot number.', title='Varix', default='') else: varix_lot = '' if upper == 'HALO': halo = pya.prompt(text='Type either "90" or "ultra".', title='Halo', default='90') message += halo + '.' upper = gnc.UPPER_DIC[upper] colon = co.get() if colon == 'Cancelled': message += 'Colon Cancelled.' colon = gnc.COLON_DIC[colon] banding = ba.get() if banding == 'Banding of haemorrhoids': message += ' Banding haemorrhoids.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' if banding == 'Anal Dilatation': message += ' Anal dilatation.' if endoscopist == 'Dr A Wettstein': message += ' Bill bilateral pudendal blocks.' banding = gnc.BANDING_DIC[banding] clips = cl.get() clips = int(clips) if clips != 0: message += 'clips * {}.'.format(clips) consult = con.get() consult = gnc.CONSULT_DIC[consult] formal_message = mes.get() if formal_message: message += formal_message + '.' op_time = ot.get() op_time = int(op_time) fund = fu.get() if fund == '': pya.alert(text='No fund!') raise BillingException insur_code = gnc.FUND_TO_CODE.get(fund, 'ahsa') if insur_code == 'ga': ref = pya.prompt(text='Enter Episode Id', title='Ep Id', default=None) fund_number = pya.prompt(text='Enter Approval Number', title='Approval Number', default=None) if insur_code == 'os': paying = pya.confirm(text='Paying today?', title='OS', buttons=['Yes', 'No']) if paying == 'Yes': fund = 'Overseas' else: fund = pya.prompt(text='Enter Fund Name', title='Fund', default='Overseas') (in_theatre, out_theatre) = in_and_out_calculater(op_time) if upper is None and colon is None: pya.alert(text='You must enter either an upper or lower procedure!', title='', button='OK') raise BillingException if banding is not None and colon is None: pya.alert(text='Must enter a lower procedure with the anal procedure!', title='', button='OK') raise BillingException if '' in (anaesthetist, endoscopist, nurse): pya.alert(text='Missing data!', title='', button='OK') raise BillingException pya.click(50, 450) while True: if not pya.pixelMatchesColor(150, 630, (255, 0, 0)): # print('Open the patient file.') # input('Hit Enter when ready.') # pya.click(50, 450) pya.alert(text='Patient file not open??') raise BillingException else: break mrn, name = front_scrape() address, dob = address_scrape() # scrape fund details if billing anaesthetist if asa is not None: (mcn, ref, fund, fund_number) = episode_getfund( insur_code, fund, fund_number, ref) else: mcn = ref = fund = fund_number = '' shelver(mrn, in_theatre, out_theatre, anaesthetist, endoscopist, asa, upper, colon, banding, nurse, clips, varix_lot, message) # anaesthetic billing if asa is not None: anaesthetic_tuple, message = bill_process( dob, upper, colon, asa, mcn, insur_code, op_time, name, address, ref, fund, fund_number, endoscopist, anaesthetist, message) to_anaesthetic_csv(anaesthetic_tuple, anaesthetist) if fund == 'Overseas': message = print_receipt( anaesthetist, anaesthetic_tuple, message) # web page with jinja2 message = message_parse(message) # break message into lines today_path = episode_to_csv( out_theatre, endoscopist, anaesthetist, name,consult, upper, colon, message, in_theatre, nurse, asa, banding, varix_lot, mrn) make_web_secretary(today_path) make_long_web_secretary(today_path) to_watched() time.sleep(2) render_anaesthetic_report(anaesthetist) close_out(anaesthetist) except BillingException: return asc.set('1') up.set('None') co.set('None') ba.set('None') cl.set('0') con.set('None') mes.set('') ot.set('20') fu.set('')
subj_line = message.subject time_now = f"{datetime.datetime.now()}" def messagesender(): mes1 = message.subject try: mes2 =message.Sender return message.Sender except AttributeError: pass input_no = pyautogui.prompt(text='How many scanned pdf emails are there?', title='Email_pdf_to_file' , default='') input_added = int(input_no)-1 ## to account for '0' num = 1 for x in range(len(messages)): email_date = f"{message.CreationTime}" if f"{time_now[0:10]}" in email_date: pass else: break if "Scanned from a Xerox" in message.subject: Item_Attach = message.Attachments for item in Item_Attach: attachment = Item_Attach.item(1) attachment.SaveAsFile(r'DESIGNATED FOLDER\\'+f"{num}.pdf")