![]() First it opens the input pdf in a web browser, then presses ctrl+p to open the print dialog but here the system print dialog will appear not the browser's own dialog (I will explain below how you can get it beforehand) then the cursor will move on the button where 'Print' button is and then perform left click on it (I will explain below how you can get the exact coordinates of the buttons beforehand). # performs ctrl+w key press which is shortcut for closing the current tab in browser but since it has only 1 tab # perform left mouse click on 'Save' button Pyautogui.moveTo(747, 558, duration=2, tween=pyautogui.easeInOutQuad) # moves cursor to the coordinate where 'Save' button is # click ctrl+v keys so which pastes the output dir (save_dir) path # perform left mouse click on the bar to edit the path Pyautogui.moveTo(569, 65, duration=2, tween=pyautogui.easeInOutQuad) # moves cursor to the coordinate where address bar of directory appeared # copy output dir path (save_dir) to clipboard # creates the output dir if doesn't exists # directory where you will save your output file ![]() # perform left mouse click on print button Pyautogui.moveTo(338, 489, duration=2, tween=pyautogui.easeInOutQuad) # moves cursor to the coordinate where 'Print' button appeared Print_jobs = win32print.EnumJobs(phandle, 0, -1, 1) Prints out all jobs in the print queue every 5 secondsįor p in win32print.EnumPrinters(win32print.PRINTER_ENUM_LOCAL, None, 1): This is a different approach but since you are okay with it so I am providing it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |