2016. 3. 11.

2개 이상의 다른 스크립트 제어하기

[출처:http://autohotkey.co.kr/b/6-200]


;다음 내용을 main.ahk라는 이름으로 저장해 주세요.

DetectHiddenWindows On
SetTitleMatchMode 2
OnExit,exit
return

;Start
^s::
run,a.ahk
run,b.ahk
return

;Pause
^p::
PostMessage,0x111,65306,,,a.ahk - AutoHotkey
PostMessage,0x111,65306,,,b.ahk - AutoHotkey
return

;Reload
^r::
PostMessage,0x111,65303,,,a.ahk - AutoHotkey
PostMessage,0x111,65303,,,b.ahk - AutoHotkey
return

;Close
^x::
PostMessage,0x111,65307,,,a.ahk - AutoHotkey
PostMessage,0x111,65307,,,b.ahk - AutoHotkey
return

exit:
PostMessage,0x111,65307,,,a.ahk - AutoHotkey
PostMessage,0x111,65307,,,b.ahk - AutoHotkey
exitapp


;다음 내용을 a.ahk라는 이름으로 저장해 주세요.

#SingleInstance force
#NoTrayIcon
CoordMode,ToolTip,Screen
Loop
{
Tooltip,%A_Index%,100,100
sleep,100
}
return

;다음 내용을 b.ahk라는 이름으로 저장해 주세요.

#SingleInstance force
#NoTrayIcon
CoordMode,ToolTip,Screen
Loop
{
Tooltip,%A_Index%,200,100
sleep,100
}
return

;-----------------------------------------------------------------

이제 main.ahk만 실행시켜 주세요.
main.ahk에서 a.ahk와 b.ahk를 제어할 수 있습니다.

Ctrl-S 로 a.ahk와 b.ahk를 시작할 수 있습니다.
Ctrl-P 는 Pause.
Ctrl-R 는 Reload.
Ctrl-X 는 a와 b를 종료시킵니다.