BluhBlah Posted October 18, 2009 Share Posted October 18, 2009 * It will do a pixelsearch/getcolor and if it fins it then it will sleep x amount of time, And after that time it will press y , But if another pixelsearch finds z while its sleeping then it will exit this loop and keep going on like this! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2009 Moderators Share Posted October 18, 2009 Xoriaz,If you want someone to write it, then go to rentacoder.You have been here long enough to know that most of us expect you to have go at it first and then post your code if it does not work. 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...
BluhBlah Posted October 18, 2009 Author Share Posted October 18, 2009 (edited) Dim $stop = 0 HotKeySet("{F4}", "toggel") HotKeySet("{F5}", "off") While 1 If $stop = 1 Then If PixelGetColor(346, 317) = 0x85744A Then Sleep (300000) If PixelGetColor(346, 317) = 0x85744A Then ExitLoop ElseIf PixelGetColor(346, 317) = 0x857440 Then Send ("!Q") EndIf WEnd Func toggel() If $stop = 0 Then $stop = 1 Else $stop = 0 EndIf EndFunc Func off() Exit EndFunc Error "Wend" statement with no matching "while" statement -.- Edited October 18, 2009 by Xoriaz Link to comment Share on other sites More sharing options...
Phaser Posted October 18, 2009 Share Posted October 18, 2009 Its not happy as you left an endif statement here EndIf WEnd Try changing it to EndIf EndIf WEnd HTH Link to comment Share on other sites More sharing options...
BluhBlah Posted October 18, 2009 Author Share Posted October 18, 2009 I was wondering if this: Sleep (300000) If PixelGetColor(346, 317) = 0x85744A Then ExitLoop [/codebox] Does it do the PixelGetColor while it sleeps? And thanks alot Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2009 Moderators Share Posted October 18, 2009 Xoriaz, Try this and see if it does what you want. I have commented liberally, so it should be easy to understand what is going on. I have tried my best to understand what you want to do when the pixel is various colours - your written description seemed more logical than your code! Dim $stop = 1 HotKeySet("{F4}", "toggle") HotKeySet("{F5}", "off") While 1 If $stop = 0 Then ; Check if the pixel is colour One If PixelGetColor(346, 317) = 0x85744A Then ; If so, begin our waiting loop $iBegin = TimerInit() ; This loop waits for 5 minutes While TimerDiff($iBegin) < 300000 ; During the loop we check to see if the pixel is colour Two and exit the loop if it is If PixelGetColor(346, 317) = 0x857440 Then ExitLoop WEnd ; The pixel has changed to colour Two or the loop has timed out ; But if the pixel is still colour One, send "Alt-Q" If PixelGetColor(346, 317) = 0x85744A Then Send ("!Q") EndIf Else ; If we are not checking anything, idle a bit to save the CPU Sleep(10) EndIf WEnd Func toggle() ; $stop is Boolean in nature, so all we need to do is toggle between 1 and 0 $stop = Not $stop EndFunc Func off() Exit EndFunc Sleep (300000) If PixelGetColor(346, 317) = 0x85744A Then ExitLoop Does it do the PixelGetColor while it sleeps?No, it does nothing at all while it sleeps, which is why you have to use a While...WEnd loop with TimerDiff so that you can call PixelGetColor during the waiting time. By the way, if you use Tidy within SciTE (Ctrl-T) it will help with errors like the WEnd/EndIf confusion you had above. 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...
BluhBlah Posted October 18, 2009 Author Share Posted October 18, 2009 Thanks alot, and sorry for my terrible explaining and coding skills:rolleyes: Also: Can i do like this instead? While TimerDiff($iBegin) < 300000 While TimerDiff($iBegin) < $delay Thanks again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2009 Moderators Share Posted October 18, 2009 Xoriaz,Can i do like this instead?While TimerDiff($iBegin) < 300000While TimerDiff($iBegin) < $delayOf course - as long as you declare $delay beforehand. sorry for my terrible explaining and coding skillsNo problems - the explaining was fine and I am sure you are improving the coding as you go along. There are plenty of good examples here o the forums. 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...
jebus495 Posted October 18, 2009 Share Posted October 18, 2009 http://www.autoitscript.com/forum/index.php?showtopic=104111&st=0&p=736979&#entry736979 ??? 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