매크로

조회 수 189 추천 0 댓글 2

#NoEnv

#Persistent

#SingleInstance, Force

#KeyHistory, 0

#InstallKeybdHook

#UseHook

#HotKeyInterval 1 

#MaxHotkeysPerInterval 127


CoordMode, pixel, screen

CoordMode, mouse, screen



F6::

Loop

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\10.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 750

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\11.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 658

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\12.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 582

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\13.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 518

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\14.bmp

if(ErrorLevel = 0)

{

    while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 463

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\15.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 465

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\16.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 423

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\17.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 387

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\18.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 354

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\19.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 325

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\20.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 200

Send {x down}

Sleep, 300

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\21.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 324

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\22.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 303

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\23.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 283

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\24.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 265

Send {x up}

}

}

else

{

ImageSearch ax, ay, 575, 1030, 610, 1050, *50 %A_ScriptDir%\25.bmp

if(ErrorLevel = 0)

{

while GetKeyState("space", "P")

{

Send, z

Sleep, 150

Send {x down}

Sleep, 0

Send {x up}

}

}

else

{

return

}

}}}}}}}}}}}}}}}}


return


F10::

{

ExitApp

}


보시다시피 위의 매크로는 특정 이미지가 하나 확인되면 스페이스 바를 누를시 그 이미지에 맞춰 반복되는 명령을 실행합니다. 그런데 스페이스바를 누르는 와중에 다른 이미지가 확인되면 그 이미지에 해당되는 명령을 실행시키고 싶습니다만 그럴려면 스페이스바를 잠시 떼었다가 다시 눌러야 되더군요.


while GetKeyState("space", "P")

{

Send, z

Sleep, 250

Send {x down}

Sleep, 750

Send {x up}

break

}


이렇게 While문 끝에 break를 넣으면 스페이스바를 계속 누르고있어도 변하는 이미지에 맞춰 다른 명령이 실행되긴 합니다만 처음부터 다시 이미지를 검색하고 명령을 실행해서 그런지 반복되는 명령 사이에 공백시간이 생겨 명령이 매끄럽게 반복되지 않습니다.


이런 문제를 해결하고싶은데 제 머리론 아무리 굴려봤자 좋은 해답이 나오질 않네요. 처음부터 잘못된 명령어를 사용한건가 싶기도 하고... 전문가의 도움이 필요합니다 :(


  • 할거엄따구 2020.04.02 12:35

    이미지검색 -> 스페이스바 누름 -> 명령 실행의 프로세스라면 getkeystate보단 keywait 명령어를 사용하는게 맞지 않나 싶은데요.

    http://autohotkeykr.sourceforge.net/docs/commands/KeyWait.htm

    참고해보시기 바랍니다.

  • 오핫배우는사람 2020.04.02 19:48
    말씀드린대로 keywait명령어도 활용해보았으나 명령사이의 공백시간이 생겨 명령이 자연스럽게 반복되지 않는 문제는 해결되지 않았습니다 :(
    구글링을 해본 결과 일반적으로 오토핫키는 멀티 쓰레드를 지원하지 않기 때문에 두개 이상의 반복문을 동시에 실행할 수 없어 그런것이라고 알게되었습니다. 오토핫키 H는 멀티 쓰레드를 지원한다고해서 그걸 사용해보려고 했으나 구글에서도 워낙 정보가 적어 H버전을 설치하는데 어려움을 겪고 있습니다. 혹시나 ahk H를 설치하는 방법을 알고 계신다면 알려주셨으면 좋겠습니다.

List of Articles
분류 제목 글쓴이 최근변경 추천
질문 매크로 제작의뢰입니다 짜용이닷 2024.03.05 0/0
질문 매크로 사용 인증을 하게 만들었는데요 개곰 2024.02.14 0/0
질문 메이플랜드 동바산6 매크로 의뢰합니다 (사례O) rwqewq 2024.02.11 0/0
질문 메이플로나월드 거탐 의뢰합니다 사레합니다 2 효재아빠 2024.02.09 0/0
질문 원하는 기능을 어떻게 구현할 수 있을지 고민입니다. riswell 2024.02.05 0/0
질문 오토핫키로 멀티 마우스가 가능한가요? JackSS 2024.01.07 0/0
질문 같은프로그램 3개 전환 질문 winactivate 식그러 2024.01.07 0/0
정보 아르테일 매랜 로나 핵 매크로 취급합니다 얼리언 2024.01.05 0/0
질문 텍스트 입력 띄어쓰기 공백 처리방법 1 반디친구 2024.01.05 0/0
질문 연타 매크로 사용중인데 Alt + 영문 조합이 안먹는 이... 순천오토 2023.12.17 0/0
질문 오토핫키로 라벨 프린터 인쇄 가능할까요? 바이라민 2023.12.10 0/0
자유 리스트박스 시간기록 함카리스마 2023.11.05 0/0
질문 D2R 게임비활성 클릭 질문드려봅니다. 5 가족오락관 2023.11.07 0/0
질문 오토핫키v2 사용하시는 분 계신가요? thankkh 2023.10.19 0/0
자유 Nox에서 특정 비활성 메세지가 안먹네요 thankkh 2023.10.18 0/0
질문 오토핫키라는게 뭔가요?? 4 가면안되나요 2024.02.07 0/0
질문 gui창이 다른창을 눌러도 작업표시줄 안나타나게 할수... 초핫 2023.09.22 0/0
질문 오토핫키 매크로만드는법 강의자료 추천좀요 1 mnbmnb 2023.08.24 1/0
질문 메이플 거탐 까만부엉이 2023.08.13 0/0
질문 하드웨어 키입력 매크로사용할때 문제 2 응애제니 2023.10.18 0/0
Board Pagination Prev 1 2345678910 ... 208 Next
/ 208

전체 최신 인기글

전체 주간 인기글