每日日報--Python-pyautogui庫-懶得手動每天點複製貼上了,所以這個用於每天帆軟報表截圖傳送到微信

STR_Liang發表於2020-12-12
'''
Author: Liang
LastEditors: Liang
Date: 2020-12-11 14:56:14
LastEditTime: 2020-12-12 18:30:20
Email: str-liang@outlook.com
FilePath: /測試練習c:/Users/Administrator/Desktop/中午聽課-自動開啟相關應用 - 副本.py
Environment: Win 10 Python 3.8
Description: 
    懶得手動每天點複製貼上了,所以這個用於每天帆軟報表截圖傳送到微信
    1、點網頁的各個子頁面;
    2、截圖,切換應用;
    3、貼上,再次切換應用。
'''

import pyautogui as auto
from time import sleep
from tkinter.messagebox import showinfo

# 預設引數 設定y=18,可以不傳參
def photo_Presc(x,y=18):
    auto.moveTo(x,y);sleep(0.2)
    auto.click();sleep(3)
    auto.press('PrtSc');sleep(0.5)
    auto.hotkey('alt','tab');sleep(0.2)
    auto.hotkey('ctrl','v');sleep(0.3)
    auto.press('Enter');sleep(0.3)
    auto.hotkey('alt','tab');sleep(0.2)

if __name__ == "__main__":
    showinfo('Wait','Hold on Please')
    sleep(3.5) # 延遲,等待開啟瀏覽器
    photo_Presc(89)
    photo_Presc(336)
    photo_Presc(538)
    photo_Presc(1198)
    photo_Presc(1500)
    photo_Presc(1750)

 

相關文章