예전에 축구게임할때랑 반복작업할때 많이 써먹었는데, 오랜만에 만지니깐 기억이 가물해서 간단 정리해봅니다.

 

www.autohotkey.com/

 

AutoHotkey

AutoHotkey provides a simple, flexible syntax allowing you to focus more on the task at hand rather than every single little technicality. It supports not only the popular imperative-procedural paradigm, but also object-oriented and command-based programmi

www.autohotkey.com

참고)

pnal.kr/16

 

[프날 오토핫키] 16. ExitApp과 return

 ExitApp 지난 강에서 핫키와 핫스트링을 썼을 때, 아래 사진처럼 수동으로 꺼주었습니다. ExitApp은 그 과정을 자동으로 해주는 명령어가 ExitApp입니다. 매개변수는 없이 단일 명령어입니다. 즉, 아

pnal.kr

 

예제1) 마우스가 랜덤으로 특정 구역에서 클릭합니다.

^f1:: // ctrl+f1
loop
{
CoordMode,Mouse,Screen// 절대 좌표이다. Screen
random,x,1400,1740
random,y,250,660
random,t,5000,8000

MouseClick, Left, x, y // 마우스 클릭
MouseMove, x, y // 마우스이동
sleep, t // 딜레이시간
}
Reload
^f2::Pause

예제2) 마우스 클릭하면 좌표가 나옵니다.

^F2::

loop 1

{

MouseGetpos, vx, vy

MsgBox, 현재 마우스 좌표는 %vx% , %vy% 입니다 

return

}

 

예제3) if 문

MsgBox, 4, 제목, 매크로시작 
IfMsgBox, Yes
{
    MsgBox, 예를 눌렀습니다. // 여기에 매크로 내용을 넣음
}
IfMsgBox, No
{
    MsgBox, 아니오를 눌렀습니다. // 여기에 매크로 내용을 넣음
}

 

예제4) 버튼

gui, add, text, x57 y10 w80 h20, 매크로
gui, add, text, x65 y30 w50 h20 vA, 0초
gui, add, Button, x20 y50 w110 h20, 시작
gui, add, Button, x20 y80 w110 h20, 종료
gui, Show

return

Button시작:
{
 
     time:=0
  
  loop{
  
      time:=time+1
      sleep,1000
     
      guicontrol,,A,%time%초

     }
  
}

Button종료:
{
 
     ExitApp
  
}

예제4) 버튼 눌러서 단축키를 실행

 

Gui, Font, S20 CBlue Bold, Verdana ;폰트크기컬러
gui, add, text, x57 y10 w180 h20, 매크로

Gui, Font, S14 C009900 W500, Verdana ;폰트크기컬러
gui, add, Button, x20 y50 w110 h20, 시작
gui, add, Button, x20 y80 w110 h20, 종료
gui, Show

return

Button시작:
GuiControl, Disable, 시작 ;버튼이 비활성화됩니다.
{
#IfWinActive ahk_class OsWindow ;OsWindow에서만 작동한다.특정윈도우에서만 동작 다른곳에서는 작동안함.

F12:: ;일시중지
	
SUSPEND  ;일시중지 명령어 다시 F12를 누르면 정상화
	
return



q::

	send,{2}
	send,{RButton}
	sleep,300
	
return
	
r::

	send,{2}
	send,{RButton}
	sleep,300

return


w::
	
	send,{Space}
	sleep,100
	
return


}
return

Button종료:
{
 
     ExitApp
  
}