You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

flairbot.py 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/python
  2. # open the user flair page and put the cursor in the css class box(first one)
  3. # open the EDIT wiki page with the set lists and prepare to run this script and immediately switch the cursopr to the end of the first line
  4. import pyautogui
  5. import os
  6. import praw
  7. # Set a counter to count the # of exceptions occur
  8. counter = 0
  9. # Start the while loop
  10. while True:
  11. try:
  12. pyautogui.time.sleep(1)
  13. pyautogui.keyDown('shift')
  14. pyautogui.press('home')
  15. pyautogui.keyUp('shift')
  16. pyautogui.keyDown('ctrl')
  17. pyautogui.press('c')
  18. pyautogui.keyUp('ctrl')
  19. pyautogui.keyDown('ctrl')
  20. pyautogui.press('tab')
  21. pyautogui.keyUp('ctrl')
  22. pyautogui.keyDown('ctrl')
  23. pyautogui.press('v')
  24. pyautogui.keyUp('ctrl')
  25. pyautogui.press('tab')
  26. pyautogui.press('return')
  27. pyautogui.time.sleep(2)
  28. pyautogui.press('tab')
  29. pyautogui.press('tab')
  30. pyautogui.press('tab')
  31. pyautogui.keyDown('ctrl')
  32. pyautogui.press('tab')
  33. pyautogui.keyUp('ctrl')
  34. pyautogui.press('down')
  35. pyautogui.press('down')
  36. pyautogui.press('end')
  37. counter += 1
  38. # Exception handle when pyautogui can't locate the renew button on the screen
  39. # or if it clicks away by mistake
  40. # this section needs work and sometimes fails to function properly
  41. except Exception:
  42. print ("Exception thrown, calculating course of action")
  43. pyautogui.press('pgdn')
  44. counter += 1
  45. print ("counter =" + str(counter))
  46. if counter >= 3: counter = 0