Ok i will star tof by saying im a noob at this but have been playign with auto it on and off for the past week or so, mainly to see how much i could do and ive done abit code wise but loops always seem to confuse me, specially when im needing an array too.
Anyway i'll try and explain the best i can.
The code below is to search for an image, one the image is found it contines with more code, what i would like to do is make it so that "if" it does not find the image its looking for it checks for an alternative image example: "warehouse1.png|warehouse2.png|warehouse3.png" this is what i have so far but it will not loop though images in my tests.
Second lot im just confused with how i would do it so many someone can help. Basically i want the code to run to a certain point and then "search" for an image before proceeding further, so far though all i ahve had is the code running in a loop repeating actions:
Hope this amde sens and if not sorry :/
Anyway i'll try and explain the best i can.
The code below is to search for an image, one the image is found it contines with more code, what i would like to do is make it so that "if" it does not find the image its looking for it checks for an alternative image example: "warehouse1.png|warehouse2.png|warehouse3.png" this is what i have so far but it will not loop though images in my tests.
Code:
$img = "t" $FileList = _FileListToArray($path, "*.png", 1) For $i = 1 to $FileList[0] $array = StringSplit($FileList[$i],"|") $image = $array[1] ;ConsoleWrite($img & @CRLF) $img = _ImageSearchArea($image, 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100) MsgBox(0,"",$image & @crlf & "coords are: " & $X & "," & $Y) MouseMove($x,$y) sleep(1000) ;ConsoleWrite($img & @CRLF) Next
Code:
Func DoInstance()
logfile("Setting up instance")
ConsoleWrite("Setting up instance")
MouseClick ("left", 500 , 608)
sleep(Random(1000,1500))
MouseClick ("left", 490 , 660)
sleep(Random(1000,1500))
MouseClick ("left", 290 , 580)
sleep(Random(1000,1500))
MouseClick ("left", 700 , 440)
sleep(Random(1000,1500))
logfile("Selecting fleets")
ConsoleWrite("Setting up fleets")
call("fleet")
logfile("Starting instance")
ConsoleWrite("Starting instance")
MouseClick ("left", 700 , 380); OK
sleep(Random(1000,1500))
logfile("End of instance")
ConsoleWrite("End of instance") ; <====== need the code to stop here and wait till image below is found before restarting the loop
$img = _ImageSearchArea($pngLoc & "close.png", 1, 0, 0, @Desktopheight, @DesktopWidth, $x, $y, 100)
If $img = True Then
logfile("collecting mail")
ConsoleWrite("collecting mail")
call ("mail")
EndIf