i am new to autohotkey i know very little, i need to make a macro in the company where i work and i need to use autohotkey to make that macro.
What I am wanting to do is this. I need to access a JAVA application that stays on my computer, but this application takes some time to start sometimes it's fast sometimes it's slow I don't know exactly how long it can take to load.
What I need the script to do is wait for an image I captured to appear on screen when the application loads, while that image doesn't look like it waits until it appears on screen.
I researched a lot about autohotkey, and the imagesearch function, but I didn't quite understand how to use it
imagefound := false
time_loopStart := A_TickCount
timeout := 6000
sleep_after_each_imagesearch := 300
CoordMode, Pixel
Loop{
ImageSearch x,y, A_ScreenWidth, A_ScreenHeight, C:\test\Javalogin.png
if ErrorLevel = 0{
imagefound := true
break
}
if(A_TickCount - time_loopSart > timeout){
break
}
sleep %sleep_after_each_imagesearch%
}
MsgBox, I found the picture
this script i found on the internet
I accept suggestions if the script needs to be redone etc.
I just need to make the script wait for the image to appear
if you have someone to help I leave my thanks :)
Here's a similar script I'm using.
Basically, it looks for the picture and if it finds it, it puts the coordinates where it found it in OutputVarX & OutputVarY. If it doesn't find it, the values are 0.
Loop,
{
; first two store the found position, next 4 as the search area in pixels, then the file.
ImageSearch, OutputVarX, OutputVarY, 0, 0, 600, 600, e:\play.bmp
; "0" means no match
if (OutputVarX > 0) {
msgbox, %OutputVarX%, %OutputVarY%
break
}
sleep, 200
}
Some hints: