본문 바로가기
창고 3/[Dev] My Codes

예약 스크린샷 자동 저장 파이썬 데모

by 부엉이의 정보 창고 2021. 12. 29.
728x90

import pyautogui
import schedule
import time

# Set a classtime in a dictionary form. 
classTime = dict({
    1 : "09:05",
    2 : "10:05",
    3 : "11:05",
    4 : "12:05",
    5 : "14:05",
    6 : "15:05",
    7 : "16:05",
    8 : "17:05",
})

# Screenshot automator ver 1.0
# Create a screenShot function to take a screenshot.
def screenShot(i): 
    myFileName = str(i) + "교시" + ".png"
    myShot = pyautogui.screenshot()
    myShot.save(r'./' + myFileName)

# Schedule the screenShot function at a certain time. 
for i in range(1,9):    
    schedule.every().day.at(classTime[i]).do(screenShot,i)

# Run a scheduled function. 
while True: 
    schedule.run_pending()
    time.sleep(1)

728x90

댓글


loading