Skip to content

Instantly share code, notes, and snippets.

@NathanLovato
Created September 18, 2018 00:25
Show Gist options
  • Save NathanLovato/313820bad6d312c6552ad75b1020dba0 to your computer and use it in GitHub Desktop.
Save NathanLovato/313820bad6d312c6552ad75b1020dba0 to your computer and use it in GitHub Desktop.
Pyautogui script to add redirects in batch in the Godot docs
"""
Pyautogui script to add redirects in batch in the Godot docs
"""
import pyautogui
import time
replace = {
"/old/url": "/new/url",
"/community/tutorials/3d/inverse_kinematics.html": "/tutorials/3d/inverse_kinematics.html", #example
}
pyautogui.moveTo(200, 200)
pyautogui.click()
for old_url in replace:
pyautogui.hotkey('ctrl', 'f')
pyautogui.typewrite('Redirect Type:')
pyautogui.press('enter')
pyautogui.press('esc')
pyautogui.press('tab')
pyautogui.press(['down', 'down'])
pyautogui.press('tab')
pyautogui.typewrite(old_url)
pyautogui.press('tab')
pyautogui.typewrite(replace[old_url])
pyautogui.press('tab')
pyautogui.press('enter')
while pyautogui.pixel(100, 80) != (68, 74, 77):
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment