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.

flair.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. # Set a counter to count the # of exceptions occur
  7. counter = 0
  8. # Start the while loop
  9. while True:
  10. try:
  11. pyautogui.time.sleep(1)
  12. pyautogui.keyDown('shift')
  13. pyautogui.press('home')
  14. pyautogui.keyUp('shift')
  15. pyautogui.keyDown('ctrl')
  16. pyautogui.press('c')
  17. pyautogui.keyUp('ctrl')
  18. pyautogui.keyDown('ctrl')
  19. pyautogui.press('tab')
  20. pyautogui.keyUp('ctrl')
  21. pyautogui.keyDown('ctrl')
  22. pyautogui.press('v')
  23. pyautogui.keyUp('ctrl')
  24. pyautogui.press('tab')
  25. pyautogui.press('return')
  26. pyautogui.time.sleep(2)
  27. pyautogui.press('tab')
  28. pyautogui.press('space')
  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. # Exception handle when pyautogui can't locate the renew button on the screen
  38. # or if it clicks away by mistake
  39. # this section needs work and sometimes fails to function properly
  40. except Exception:
  41. print ("Exception thrown, calculating course of action")
  42. pyautogui.press('pgdn')
  43. counter += 1
  44. print ("counter =" + str(counter))
  45. if counter >= 3: counter = 0