refactor script.py

This commit is contained in:
Emi
2025-07-05 23:10:41 -03:00
parent 3395c619bc
commit 0519e67cb0

View File

@@ -1,24 +1,22 @@
import pyautogui as pgui
import time
import keyboard as kb
import sys
quit = False
# Enter the name of your browser, based on the name of its icon image.
browser = 'brave'
browser_img = 'brave.png'
browser_loc = pgui.locateCenterOnScreen(f'img/{browser}.png', confidence=0.8)
browser_loc = pgui.locateCenterOnScreen(f'img/{browser_img}', confidence=0.8)
if browser_loc:
pgui.moveTo(browser_loc, duration=0.2)
time.sleep(0.2)
pgui.click()
# Change the time depending on how long it takes to open your browser
time.sleep(2)
else:
print("Browser icon not found.")
exit()
sys.exit('closing script')
pgui.hotkey('ctrl', 't')
@@ -29,12 +27,11 @@ pgui.press("enter")
# change depending on how long it takes to load yt
time.sleep(5)
while not quit:
while True:
if kb.is_pressed('q'):
print(':(')
quit = True
continue
break
opt_loc = pgui.locateCenterOnScreen('img/options.png', confidence=0.8)