import pyautogui screenWidth, screenHeight = pyautogui.size() currentMouseX, currentMouseY = pyautogui.position() pyautogui.moveTo(1, 1, duration=1) pyautogui.moveTo(screenWidth / 2, screenHeight / 2) #look for the emulator icon and if found then: button7location = pyautogui.locateOnScreen('button.png') # returns (left, top, width, height) of matching region pyautogui.doubleClick() #pyautogui.typewrite('How are you?!', interval=0.25) # type with quarter-second pause in between each key pyautogui.press('space') pyautogui.press('space') pyautogui.press('space') pyautogui.press('space') pyautogui.PAUSE = 10 pyautogui.press('space') pyautogui.press(['left','left','left','left','left','left','left','left','left','left','left', 'left', 'left', 'left', 'left', 'left'])