Skip to content

Instantly share code, notes, and snippets.

@n0an
Created May 17, 2017 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n0an/715afec920bb351b69f5f19b4ce7a94b to your computer and use it in GitHub Desktop.
Save n0an/715afec920bb351b69f5f19b4ce7a94b to your computer and use it in GitHub Desktop.
pdf from visio
#! python3
import pyautogui, time, logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s.%(msecs)03d: %(message)s', datefmt='%H:%M:%S')
# Set these to the correct coordinates for your particular computer.
uncheckAutoOpenPDF = (139, 522)
pyautogui.PAUSE = 5.0
# firstRun = True
print('>>> 5 SECOND PAUSE TO LET USER PRESS CTRL-C <<<')
time.sleep(5)
while True:
logging.info('F12 pressed.')
pyautogui.typewrite(['F12'])
logging.info('tab pressed.')
pyautogui.typewrite(['tab'])
logging.info('p pressed.')
pyautogui.typewrite('p')
logging.info('tick clicked.')
pyautogui.moveTo(139, 522, duration = 0.5)
pyautogui.click()
logging.info('ENTER pressed.')
pyautogui.typewrite(['enter'])
logging.info('ALT+F4 pressed.')
pyautogui.hotkey('alt', 'f4')
logging.info('Right pressed.')
pyautogui.typewrite(['right'])
logging.info('ENTER pressed.')
pyautogui.typewrite(['enter'])
print('pdf done')
time.sleep(2)
print('=== Starting next one ===')
logging.info('Down pressed.')
pyautogui.typewrite(['down'])
logging.info('ENTER pressed.')
pyautogui.typewrite(['enter'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment