Asdafa Posted July 1, 2010 Share Posted July 1, 2010 hi i made this code that checks a image. I did not made that code but the code that i need wich 1 u can see here under. What the code does is checking for a image. when it is found it will give the image 5 star. But if the image is not found in 1500 sec it needs to close. Only thing is. It does not close. i don't know whats wrong, tryed other functions but i don't know whats wrong. Like u can see i'm useing a timer. I tested the timer before and it works well. A bit help with a explanation would be real nice. expandcollapse popupHotkeySet ("{delete}", "STD") #include <ImageSearch.au3> a() Func a() $Timedif = 1500 $Timer = TimerInit() While 1 If (TimerDiff($Timer)/1000) < $Timedif Then sleep (10) a0() Else STD() $Timer = TimerInit() EndIf WEnd EndFunc Func STD() ProcessClose("check.exe") $PID = ProcessExists("check.exe") If $PID Then ProcessClose($PID) EndFunc func a0() dim $res $x = 0 $y = 0 $res = _imagesearcharea('check.bmp',1,0,0,0,0,$x,$y,100) If $res = 1 Then sleep (10) Kees() Else mouseclick ("left", 180,180,2,1) EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 1, 2010 Moderators Share Posted July 1, 2010 Asdafa, It does not closeBecause you never ask it to close! Look at this section of your code and my comments: $Timedif = 1500 $Timer = TimerInit() While 1 If (TimerDiff($Timer) / 1000) < $Timedif Then ; Here is the code that will run if we are at less than 1500 secs Sleep(10) a0() Else STD() ; If we get past 1500 secs we end up here ; You now reset the timestamp so that when we get to the top of the loop again we run the code above for another 1500 secs!!!! $Timer = TimerInit() EndIf WEnd You need to rethink the logic of this bit if you want to Exit at some point! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now