#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
f8::
Msgbox,4,,프로그램을 다시 시작할까요?, F9 → 시작 | F10 → 종료
ifMsgBox, Yes, Reload
return
Instructions:
RunProcess()
return
RunProcess()
{
; 1. 대상 앱 찾아서 실행
res := RunApp()
TrayTip #1, [RunApp] %res%
if res
{
; 2. 스플래쉬 캡쳐
Capture()
; 3-1. 전면 팝업 캡쳐
Capture()
; 3-2. 닫기 버튼이 있으면 닫기
Back()
; 4. 홈 화면 캡쳐
Capture()
Back()
; 5. 종료 팝업 캡쳐
Capture()
PressExit()
}
else
{
; 5. 종료 팝업 캡쳐
Back()
PressExit()
}
}
f9::
RunProcess()
Settimer, Instructions, 40000
return
f10::
Settimer, Instructions, off
return
PressExit()
{
SwitchApp()
Sleep, 5000
success := ImageClick(".\img\exit.png")
if !success
ImageClick(".\img\exit2.png")
}
ImageClick(file)
{
success := False
; 앱 아이콘 위치 확인
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %file%
if (ErrorLevel = 2)
MsgBox Could not conduct the search.
else if (ErrorLevel = 1)
TrayTip #1, [ImageSearch] %file% Icon could not be found on the screen.
else{
MouseClick, left, FoundX, FoundY
success := True
}
return success
}
Back()
{
SwitchApp()
Send ^+2
}
Capture()
{
SwitchApp()
Sleep, 5000
Send ^+s
}
RunApp()
{
SwitchApp()
; 앱 아이콘 위치 확인
success := ImageClick(".\img\app.png")
if !success
{
Back()
PressExit()
return False
}
return True
}
SwitchApp()
{
;Settimer, Instructions, 10000 ; 18.000 ms = 3 minutes
IfWinExist ahk_exe Bluestacks.exe
WinActivate
}