#NoEnv
#KeyHistory 0 
#Singleinstance Force
#Include Gdip_All.ahk
#Include Gdip_imagesearch.ahk
#Include search_img.ahk
SetWorkingDir, %A_ScriptDir%
SetKeyDelay, -1
SetWinDelay, -1
SetBatchLines, -1
SetControlDelay, -1
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
gui,show,w100 h100 center,chapter13
gui,Add,Button,x0 y0 w100 h50 gStart,Start
gui,Add,Button,x0 y50 w100 h50 gStop,Stop
return

global Tt

Tt :=  NAVER - Chrome

Start:
{
WinGet, winid, ID, %Tt%
if(search_img(winid,"image\mail.bmp", x, y)=0)
{
MsgBox,0
MsgBox, %x%, %y%, %pBitmapNeedle%, %pBitmapHayStack%, %winid%
}
else
{
MsgBox,1
MsgBox, %x%, %y%, %pBitmapNeedle%, %pBitmapHayStack%, %winid%, not
}
}
return

PostClick(FoundX,FoundY)
{
lparam:=FoundX|FoundY<<16
PostMessage,0x201,1,%lparam%,,%Tt%
PostMessage,0x202,0,%lparam%,,%Tt%
Sleep, 500
}

GuiClose:
Stop:
Gdip_Shutdown(pToken)
ExitApp
return

==========================================================================
/*
@
@위가 실행하는 파일입니다
@
@밑이 #Include search_img.ahk 파일입니다
@
/* 
===========================================================================

#include gdip_imagesearch.ahk
#include gdip_All.ahk

search_img(hwnd, image, byref x, byref y, x1="0", y1="0", x2="0", y2="0", Variation="0",Trans="")
{
pToken := Gdip_Startup() 
pBitmapHayStack := Gdip_BitmapFromhwnd(hwnd) 
pBitmapNeedle := Gdip_CreateBitmapFromFile(image) 
Sleep, 100
if Gdip_ImageSearch(pBitmapHayStack,pBitmapNeedle,list,x1,y1,x2,y2,Variation,Trans,1,1) 
{  
Gdip_DisposeImage(pBitmapHayStack)
Gdip_DisposeImage(pBitmapNeedle)
StringSplit, LISTArray, LIST, `,  
x:=LISTArray1 
y:=LISTArray2
Gdip_DisposeImage(pBitmapHayStack), Gdip_DisposeImage(pBitmapNeedle)
Gdip_Shutdown(pToken)
return 0
}
else 
{
Gdip_DisposeImage(pBitmapHayStack), Gdip_DisposeImage(pBitmapNeedle)
Gdip_Shutdown(pToken)
return 1
}
}

==================================================================================
혹시 잘못된 부분이 있다면 지적해주시면 감사하겟습니다ㅠ
이대로 실행 했을때 서치 실패인지 else 부분으로만 넘어갑니다
MsgBox 부분도 winid를 제외한 다른 부분은 모두 , , , 빈칸으로 표시됩니다
검색을 하다가 함수가 저장된 파일의 문제라는 글을 봐서 다른분들의 파일로 시도해봣지만 전부 먹히지 않았습니다
64bit, 32bit 둘 다 시도해봣습니다ㅠ 오류코드는 -1001로 나옵니다
-1001이 bitmap이 제대로 생성되지않았다는 뜻이라고 하던대 bitmap이 이미지파일.bmp를 뜻하는건가요?
혹시 몰라서 이미지와 확장자를 다 바꿔봐도 안돼더라구요
혹시 윈도우7은 안돼나요?

다들 좋은 하루 보내세요~^*^

답글