Last active
January 26, 2020 05:23
-
-
Save addohm/7730ebaad959114ca4ab3ee9f2495a51 to your computer and use it in GitHub Desktop.
Find Type Swapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyautogui | |
import time | |
pyautogui.PAUSE = 0.1 | |
pyautogui.FAILSAFE = True | |
screensize = pyautogui.size() | |
screenX_center = screensize.width / 2 | |
screenY_center = screensize.height / 2 | |
def make_active_window(): # click the top left corner of the screen to make window active | |
# Assuming full screen mode, make the top window active on monitor 1 | |
try: | |
pyautogui.click(x=5, y=5, clicks=1, interval=1.0, button='left') | |
print('Made window active.') | |
except KeyboardInterrupt: | |
print('\nDone.') | |
def toggle_find(): | |
# Check whether the mouse is positioned within monitor 1 | |
if pyautogui.position().x <= screensize.width: | |
# Press the find mineral macro (/castsequence find herbs, find minerals) | |
pyautogui.press('pagedown') | |
if __name__ == '__main__': | |
make_active_window() | |
while True: | |
try: | |
toggle_find() | |
time.sleep(4) | |
except KeyboardInterrupt: | |
print('\nDone.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment