fix error on browser location error

This commit is contained in:
Emi
2025-07-05 23:21:38 -03:00
parent 08dc823afb
commit 72b8b39076

View File

@@ -23,7 +23,7 @@ listener.start()
# Enter the name of your browser, based on the name of its icon image. # Enter the name of your browser, based on the name of its icon image.
browser_img = 'brave.png' browser_img = 'brave.png'
try:
browser_loc = pgui.locateCenterOnScreen(f'img/{browser_img}', confidence=0.8) browser_loc = pgui.locateCenterOnScreen(f'img/{browser_img}', confidence=0.8)
if browser_loc: if browser_loc:
@@ -31,7 +31,7 @@ if browser_loc:
pgui.click() pgui.click()
# Change the time depending on how long it takes to open your browser # Change the time depending on how long it takes to open your browser
time.sleep(2) time.sleep(2)
else: except (pgui.ImageNotFoundException, Exception):
print("Browser icon not found.") print("Browser icon not found.")
sys.exit('closing script') sys.exit('closing script')