import pyautogui
import time

def perform_automation():
    # 5초의 준비 시간 부여
    print("5초 후에 자동화가 시작됩니다. 마우스와 키보드에서 손을 떼세요!")
    time.sleep(5)

    print("마우스 이동 및 클릭 시작")
    
    # 메모장(notepad)을 실행하고 텍스트 입력하는 예시
    # 윈도우 키 누르기
    pyautogui.press('win')
    time.sleep(1)
    
    # 'notepad' 입력
    pyautogui.write('notepad')
    time.sleep(1)
    
    # 엔터 키 누르기
    pyautogui.press('enter')
    time.sleep(2) # 메모장이 열릴 때까지 대기
    
    # 메모장에 텍스트 입력
    pyautogui.write('Hello, this is Python speaking!', interval=0.1)
    time.sleep(1)
    
    # 메모장 닫기 (Alt + F4)
    pyautogui.hotkey('alt', 'f4')
    time.sleep(1)

    # '저장하지 않음' 클릭 (버튼 위치는 화면 해상도에 따라 달라질 수 있음)
    # 이 부분은 실행 환경에 따라 에러가 날 수 있어 주석 처리하고 설명해 주는 것이 좋습니다.
    # pyautogui.click(x=950, y=550) # 예시 좌표
    
    print("자동화 스크립트 실행 완료!")

if __name__ == "__main__":
    try:
        perform_automation()
    except pyautogui.FailSafeException:
        # 화면의 왼쪽 상단 모서리로 마우스를 이동하면 스크립트가 중단됨
        print("스크립트가 중단되었습니다. (안전 종료 기능)")
    except Exception as e:
        print(f"오류가 발생했습니다: {e}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: