Hello again all. I've found the autoIt Help file is amazing at answering questions, however I have not been able to find any documentation there for _ImageSearchArea. My google results have been just as unsuccessful so I'm hoping someone can help me understand how it works by providing a couple of concrete examples.
So, would someone be able to show me a couple of examples, such as
1) If my desktop is 1024 x 768 and I want to search only the top half of the desktop area for an image called blue_btn.png, what would that look like.
2) If my desktop is 1024 x 768 and I want to search only the left half of the desktop area for an image called blue_btn.png, what would that look like.
3), lastly, if my desktop is 1024 x 768, and I want to constrain the search to a box that is centered and is 800 wide by 400 tall (for the same image as above).
that helps, is @DesktopWidth an automagically stored variable or is this a real number, ie would I need to put "1024" in wherever you have @DesktopWidth ?
that helps, is @DesktopWidth an automagically stored variable or is this a real number, ie would I need to put "1024" in wherever you have @DesktopWidth ?
@DesktopWidht and @DesktopHeight are macros which contains automatically your current desktop resolution
Got it, thanks, that helped a ton. This is the best explanation of _ImageSearchArea on the net. My script is so much faster now and I'm only partially done with it
Just at looking at it i can see that every single function would produce an stack overflow error.
calling the function over and over again will only fill the stack until it its full.
and after taking a closer look at it i see that you put the value 0 in the variables x and y, and never change it. that means when it finds the image, it moves the mouse to position 0,0 on the screen.
Just at looking at it i can see that every single function would produce an stack overflow error.
calling the function over and over again will only fill the stack until it its full.
and after taking a closer look at it i see that you put the value 0 in the variables x and y, and never change it. that means when it finds the image, it moves the mouse to position 0,0 on the screen.
god.. this was just a explaination how _imagesearcharea works, what arguments are needed, he understand it so gtfo
Here is the code for people who only got the ability to copy paste without using their brain
Code:
#include <ImageSearch.au3>
Global $found = False, $X, $Y
;Search for the Pic at the Top half until its found;
Do
$found = _Top_half()
sleep(25)
Until $found = True
$found = False
;Search for the Pic at the Left half until its found;
Do
$found = _Left_half()
sleep(25)
Until $found = True
$found = False
;Search for the Pic at the Center until its found;
Do
$found = _Centered()
sleep(25)
Until $found = True
$found = False
Exit
Func _Top_half()
$bResult = _ImageSearchArea(@ScriptDir & "\blue_btn.png",1,0,0,@DesktopWidth,@DesktopHeight * 0.5,$X, $Y, 0)
If $bResult = 1 Then
MouseClick("LEFT",$X, $Y)
Return True
Else
Return False
EndIf
EndFunc
Func _Left_half()
$bResult = _ImageSearchArea(@ScriptDir & "\blue_btn.png",1,0,0,@DesktopWidth * 0.5,@DesktopHeight,$X, $Y, 0)
If $bResult = 1 Then
MouseClick("LEFT",$X, $Y)
Return True
Else
Return False
EndIf
EndFunc
Func _Centered()
$centerX = @DesktopWidth * 0.5
$centerY = @DesktopHeight * 0.5
$bResult = _ImageSearchArea(@ScriptDir & "\blue_btn.png",1,$centerX -400, $centerY -200, $centerX +400,$centerY +200,$X, $Y, 0)
If $bResult = 1 Then
MouseClick("LEFT",$X, $Y)
Return True
Else
Return False
EndIf
EndFunc
***.. this was just a explaination how _imagesearcharea works, what arguments are needed, he understand it so gtfo
jeese. i only pointed out a mistake you did (one that i until some weeks ago didnt even know about that it exists). im sorry but thats no reason to say "gtfo".
Well I don't know about all that jive trying to use a function to find it, seems to overcomplicate the matter. I just used the method to locate the center and then went from there, ie:
Code:
;Press accept function ----------------------------------------------------------
Func pressAccept()
Local $result = _ImageSearchArea("pics/login/accept_btn.png", 1, $centerX -150, $centerY -70, $centerX +150,$centerY +70,$x, $y, $tol)
If ($result == 1) Then
MouseClick("left", $x, $y, 1)
EndIf
EndFunc
;Press accept function ----------------------------------------------------------
_ImageSearchArea Hilfe !!! 10/22/2010 - AutoIt - 4 Replies Hallo alle zusammen ,
wie der Titel schon sagt ich brauche hilfe bei
_ImageSearchArea...
Ich blicke im moment garnicht durch deswegen würde ich etwas um Hilfe bitten.
Ihr könnt mir einfach nur erklären was wo hin muss etc etc etc
ich verstehe im moment den ganzen aufbau der funktion