오차:=50
Gui, Add, CheckBox, x12 y10 w70 h20 va ga, 특정범위
Gui, Add, Text, x12 y40 w50 h20 , 여기부터
Gui, Add, Edit, x12 y60 w50 h20 v범위1,?
Gui, Add, Edit, x72 y60 w50 h20 v범위2,?
Gui, Add, Text, x132 y40 w50 h20 , 여기까지
Gui, Add, Edit, x132 y60 w50 h20 v범위3,?
Gui, Add, Edit, x192 y60 w50 h20 v범위4,?
Gui, Add, Button, x92 y10 w60 h20 g오차, 오차
Gui, Add, Text, x12 y90 w50 h20 , 그림파일
Gui, Add, Edit, x12 y110 w170 h20 vFileName, %FileName%
Gui, Add, Button, x182 y110 w60 h20 gSelect, 폴더열기
; Generated using SmartGUI Creator 4.0
Gui, Show, x127 y87 h142 w254,?
GuiControl,Disable,범위1
GuiControl,Disable,범위2
GuiControl,Disable,범위3
GuiControl,Disable,범위4
GuiControl,,범위1,0
GuiControl,,범위2,0
GuiControl,,범위3,A_ScreenWidth
GuiControl,,범위4,A_ScreenHeight
return
a:
Gui,submit,nohide
if a=1
{
GuiControl,,범위1,
GuiControl,,범위2,
GuiControl,,범위3,
GuiControl,,범위4,
GuiControl,Enable,범위1
GuiControl,Enable,범위2
GuiControl,Enable,범위3
GuiControl,Enable,범위4
}
else
{
GuiControl,,범위1,0
GuiControl,,범위2,0
GuiControl,,범위3,A_ScreenWidth
GuiControl,,범위4,A_ScreenHeight
GuiControl,Disable,범위1
GuiControl,Disable,범위2
GuiControl,Disable,범위3
GuiControl,Disable,범위4
}
return
오차:
Inputbox,오차,Image오차값,현재값 %오차%,,150, 130
return
Select:
FileSelectFile,Name,,,이미지찾기,이미지파일 (*.bmp; *.jpg; *.png)
;FileSelectFile,Name,,,찾을이미지, Text Documents (*.txt; *.doc)
if errorlevel = 0
{
guicontrol,,FileName,%Name%
}
return
F1::
Gui,submit,nohide
coordmode, mouse, screen
coordmode, pixel, screen
ImageSearch,vx,vy,%범위1%,%범위2%,%범위3%,%범위4%,*%오차% %Name%
if errorlevel=0
{
MouseMove,%vx%,%vy%
MsgBox,찾음
}
if errorlevel=1
{
MsgBox,못찾음
}
return
GuiClose:
ExitApp
위 스크립트에서 체크박스 체크안하고 핫키(F1) 누르면 이미지서치가 안돼요.
고수님들 뭐가 잘못된건가요??
체크를 하는순간 구이창값을 읽어들입니다
구이창의 값이 각 지정된 변수에 할당됩니다.
그리고 나서 구이창의 값을 아무것도 없는것으로 바꿔버립니다.
현재 적용되어 있는 변수의 값은 바꾸기전에 값(0,0,A_ScreenWidth,A_ScreenHeight)이 저장되어 있습니다.
이때, 이미지서치를 하면 제대로 작동되죠, 값이 들어가 있으니까요.
체크를 해제하는순간 구이창의 아무것도 없는값을 읽어들이고 변수에 할당합니다.
그리고 a=0 이므로 else 문을 실행하게 되죠.
이때는 변수에 값이 없으므로 이미지를 찾지 못하는것입니다.
guicontrol로 구이창의 값을 바꾸는 명령은 구이창의 값만을 바꿀뿐입니다.
현재 진행중인 스크립트내에서 사용되어지는 변수의 값이 변하는게 아닙니다.
구이창의 값을 바꾸고 바뀐 값을 바로 사용할려면,
범위4:=A_ScreenHeight ;변수를 정의
Gui,submit,nohide ;구이창의 값을 제출하라
둘중 하나를 사용하시면 됩니다.