Last active
December 2, 2020 23:14
-
-
Save 0187773933/76b8dfd4ee788bda888486f98add7bad to your computer and use it in GitHub Desktop.
Restarts Microsoft Word Dictation After Silence Timeouts
This file contains hidden or 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 time | |
| import pyscreeze | |
| import pyautogui | |
| # 1.) Probing For Location on Fullscreen on Vizio Monitor with Word Maximized | |
| # Fullscreen Dimensions According to PIL = ( 1883 , 1019 ) | |
| # ( left , top , width , height ) | |
| # time.sleep(3) | |
| # So its always 273 offset from Fullscreen | |
| # pyscreeze.screenshot( 'probe.png' , region=( 1610 , 64 , 46 , 60 ) ) | |
| def is_recording(): | |
| latest = pyscreeze.screenshot( 'probe.png' , region=( 1610 , 64 , 46 , 60 ) ) | |
| center_pixel = latest.getpixel( ( 23 , 25 ) ) | |
| # Dark Theme | |
| # blue = not recording = ( 0 , 99 , 177 ) | |
| # black = recording = ( 72 , 70 , 68 ) | |
| print( center_pixel ) | |
| if 60 <= center_pixel[0] <= 80: | |
| if 60 <= center_pixel[1] <= 80: | |
| if 60 <= center_pixel[2] <= 80: | |
| return True | |
| return False | |
| def click_record_button(): | |
| center = pyscreeze.center(( 1610 , 64 , 46 , 60 )) | |
| pyautogui.click( center.x , center.y ) | |
| time.sleep( 3 ) | |
| while True: | |
| time.sleep( 0.5 ) | |
| if is_recording() == False: | |
| click_record_button() | |
| time.sleep( 1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment