Switch to a specific app that is opened other than using pyautogui (alt tab) on Python

Viewed 22

I am working on a code that uses pyautogui and the only thing I need is to switch to a already openned application other than alt + tab to it, for example:

import pyautogui

def start():

    #here comes the code that swap to the already oppened app, Paint.exe for example
    
    pyautogui.click(x, y) #click on a tool
    pyautogui.click(x, y) #select a colour
    pyautogui.click(x, y) #paint the background

This is only a example, my code is a lot more complex and I am using pyautogui.hotkey("alt", "tab") as a solution to that, but the app always need to be the last one used, otherwise it wont switch to it, so that results in error sometimes.

Does anyone know a solution to this?

0 Answers
Related