41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
![]() |
import pyautogui
|
||
|
import pytesseract
|
||
|
|
||
|
|
||
|
# # ws = pygetwindow.getAllWindows()
|
||
|
# # for x in ws:
|
||
|
# # print(x.title)
|
||
|
#
|
||
|
# wd = pygetwindow.getWindowsWithTitle("PowerShell")
|
||
|
# print(wd[0])
|
||
|
# wd[0].activate()
|
||
|
# wd[0].maximize()
|
||
|
# screenshot = pyautogui.screenshot("screenshot.png")
|
||
|
# print(screenshot)
|
||
|
# print(pytesseract.get_languages())
|
||
|
# result = pytesseract.image_to_string(screenshot)
|
||
|
# # print(result)
|
||
|
|
||
|
def get_status():
|
||
|
window = pyautogui.getWindowsWithTitle("Mozilla Firefox")
|
||
|
|
||
|
window = window[0]
|
||
|
window.maximize()
|
||
|
window.activate()
|
||
|
# pyautogui.click(900, 140)
|
||
|
# clipboard.copy("网络")
|
||
|
# pyautogui.hotkey('ctrl', 'a')
|
||
|
# pyautogui.hotkey('ctrl', 'v')
|
||
|
# pyautogui.press('enter')
|
||
|
# pyautogui.click(x=window.width // 2, y=window.height // 2)
|
||
|
screenshot = pyautogui.screenshot()
|
||
|
screenshot = screenshot.crop((313, 46, 1118, 79))
|
||
|
screenshot.save('screenshot.png')
|
||
|
result = pytesseract.image_to_string(screenshot)
|
||
|
print(result)
|
||
|
# pyautogui.click(1920, 20)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
get_status()
|