매크로

조회 수 829 추천 0 댓글 5
아래 코드로 이미지서치를 한번 해보려고 했는데요. 실행하니까 Target Label does not exist 
가 나오네요.. 코드를 그대로 따온건데 뭐가 문제일까요?

#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.
#include Gdip.ahk
#include Gdip_ImageSearch.ahk

ImageSearch_Inactive(Title, ImgFileName)
{
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you ha1ve gdiplus on your system
ExitApp
}
OnExit, Exit

pBitmapHayStack := Gdip_BitmapFromHWND(hwnd := WinExist(Title)) 
pBitmapNeedle := Gdip_CreateBitmapFromFile(ImgFileName)

Width1 := Gdip_GetImageWidth(pBitmapHayStack), Height1 := Gdip_GetImageHeight(pBitmapHayStack)
Width2 := Gdip_GetImageWidth(pBitmapNeedle), Height2 := Gdip_GetImageHeight(pBitmapNeedle)
E1 := Gdip_LockBits(pBitmapHayStack, 0, 0, Width1, Height1, Stride1, Scan01,BitmapData1)
E2 := Gdip_LockBits(pBitmapNeedle, 0, 0, Width2, Height2, Stride2, Scan02,BitmapData2)

MCode(Gdip_ImageSearch, "83EC148B4424309983E20303C28BC88B442434995383E2035503C2C1F80256C1F902837C24"
. "30005789442420C7442410000000000F8EBE0000008B5C24288B7C24388D048D00000000894424188B442430895C241CE"
. "B098DA424000000008BFFC74424440000000085C07E6D895C24148B6C242CC7442440000000008D6424008B4C24403B4C"
. "243C0F8D8600000033C985FF7E158BD58BF38B063B02751F4183C20483C6043BCF7CEF8B442420035C2418FF44244003C"
. "003C003E8EBC38B4C24448B5C24148B4424304183C3043BC8894C2444895C24147C978B4C24108B5C241C035C2418413B"
. "4C2434894C2410895C241C0F8C68FFFFFF8B5424488B44244C5F5E5DC702FFFFFFFFC700FFFFFFFF5B83C414C38B4C244"
. "48B5424488B44244C5F495E890A8B4C24085D89085B83C414C3")

Time1 := A_TickCount
VarSetCapacity(x, 8, 0), VarSetCapacity(y, 8, 0)
Loop, 100
DllCall(&Gdip_ImageSearch, "uint", Scan01, "uint", Scan02, "int", Width1, "int", Height1, "int", Width2, "int", Height2, "int", Stride1, "int", Stride2, "int*", x, "int*", y)
MsgBox, % "Time for 100 searches: " A_TickCount-Time1 "ms`nx: " x "`ny: " y ;%

Gdip_UnlockBits(pBitmapHayStack,BitmapData1), Gdip_UnlockBits(pBitmapNeedle,BitmapData2)
Gdip_DisposeImage(pBitmapHayStack), Gdip_DisposeImage(pBitmapNeedle)
return
}

MCode(ByRef code, hex)
{
VarSetCapacity(code, StrLen(hex)//2)
Loop % StrLen(hex)//2 ;%
NumPut("0x" SubStr(hex, 2*A_Index-1, 2), code, A_Index-1, "char")
}

F9::
ImageSearch_Inactive("testing1","%A_ScriptDir%\Images\linicon.bmp")

  • 리체 2017.08.27 20:55

    ImageSearch_Inactive("testing1",A_ScriptDir "\Images\linicon.bmp")

  • 험블비 2017.08.27 21:07
    리체님 답변들 너무 감사드립니다. 근데 알려주신 대로 넣었더니 다른 에러가 떴어요 :
    C:\Users\surami\Desktop\???\??.ahk (53) : ==> The leftmost character above is illegal in an expression.
    Specifically: \Images\linicon.bmp"
  • 리체 2017.08.27 21:16
    " 기호를 잘못 넣으신듯...다시 잘 검토 해보세요
  • 험블비 2017.08.27 21:29
    디버깅을 해보니까 16번 라인 - OnExit, Exit 에 문제가 있다고 나옵니다 ㅜ_ㅜ
  • 할거엄따구 2017.08.27 23:04

    Exit:
    Gdip_Shutdown(pToken)
    ExitApp
    return

    이거 덜가져오신듯...

    맨밑에 추가해주세요..


List of Articles
분류 제목 글쓴이 최근변경 추천
질문 Thread, Priority,n 을 잘 모르겠습니다.. 화프 2016.04.21 0/0
질문 this application is protected 오류 세븐길들이기 2023.02.24 0/0
질문 this application is protected with unregistered ver... 앙븐각 2016.08.24 0/0
질문 themida 사용하시는분 계신가요? 7 호로록뚝딱 2014.11.26 0/0
질문 Target Label does not exist 에러가 뜹니다 5 험블비 2017.08.27 0/0
질문 T7GG님 비활성 매크로 질문입니다. 14 bleuG 2016.06.24 0/0
질문 suspend나 pause를 gui에 표시할수 있나요? 2 ddfa4 2017.03.05 0/0
질문 SPY ClassNN 값 편하게 가져오는방법 있나요? 4 신령공주 2016.05.22 0/0
질문 splashimage(스플래쉬이미지) 관련해서 해결법좀 ㅠ 2 몬길을하자 2016.12.07 0/0
질문 splashimage 질문좀요 ㅠㅠ 8 shcjf 2015.01.11 0/0
자유 Soundbeep 5 보득 2015.02.02 2/0
정보 SMTP 메일보내기 13 모바게 2020.08.10 2/0
질문 smartgui 공식 사이트가 어디인가요"? 2 응응s 2015.05.28 0/0
질문 smart gui 질문입니다 3 올드휴고 2015.02.14 0/0
질문 smart gui 질문이에요~ 2 올드휴고 2015.02.15 0/0
질문 smart gui 질문이에요~ 3 올드휴고 2015.03.12 0/0
질문 Sleep 에 Edit창에 입력한 값을 적용하려고합니다. 5 우리강아지 2016.05.19 0/0
질문 sleep 시간 질문 1 응애제니 2022.11.01 0/0
질문 sidesync 이미지를 못찾네요 복권상인 2016.08.23 0/0
질문 Shell.Explorer 새로고침? 13 _Crash 2015.04.21 0/0
Board Pagination Prev 1 ... 170171172173174175176177178 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글