Code/Study

[AutoHotkey] SetTimer & PostMessage

Hide Code 2010. 4. 18. 12:15
"메모장 정보" 창이 뜰 때 마다 "확인" 버튼을 자동으로 클릭해주는 예제

#Persistent

BM_CLICK := 245

SetTitleMatchMode, Regex
OnExit, ExitSub
SetTimer, MyLabel, 1000
return

MyLabel:
PostMessage, BM_CLICK , 0, 0, Button1, 메모장 정보
return

ExitSub:
SetTimer, MyLabel, Off
ExitApp ; The only way for an OnExit script to terminate itself is to use ExitApp in the OnExit subroutine.



#Persistent

WM_CLOSE := 0x10
WM_COMMAND := 0x111
BM_CLICK := 0XF5

SetTitleMatchMode, Regex
OnExit, ExitSub
SetTimer, MyLabel, 5000
return

MyLabel:
PostMessage, WM_COMMAND , 0X41, 0, , 메모장
Sleep, 1000
PostMessage, BM_CLICK , 0, 0, Button1, 메모장 정보
return

ExitSub:
SetTimer, MyLabel, Off
ExitApp