Adergon Posted January 15, 2012 Share Posted January 15, 2012 (edited) SOLVED!!!Edit: Reset the title to something ressembling the original!Adergon,Please do not do this again - just add [sOLVED] to the title, not replace it. M23 Edited January 15, 2012 by Melba23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,Look at TimerInit and TimerDiff. Then you can code something like this:$iBegin = TimerInit() While TimerDiff($iBegin) < whatever_delay_you_want Your_Code WEnd ; You get here when the delay endsAll clear? 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 Adergon, Look at TimerInit and TimerDiff. Then you can code something like this: $iBegin = TimerInit() While TimerDiff($iBegin) < whatever_delay_you_want Your_Code WEnd ; You get here when the delay ends All clear? M23 This probably works, but i don't know where to put the delay? do you mean like this? While TimerDiff($iBegin) < 10000 Delay for 10 secs. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon, Have you tried? Yes! 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 (edited) Adergon, Have you tried? Yes! M23 $iBegin = TimerInit() While TimerDiff($iBegin) < 10000 Do $TestPixel=PixelSearch(302, 26, 817, 359, $PixelTest, 5) Until Not @error MouseMove(0,0) WEnd MouseMove(15,3) I tried this, but still, after 10 seconds. it doesnt move on. it still keeps trying to find it EDIT: i added a mousemove and the end too so i know it has moved on:P Edited January 15, 2012 by Adergon Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2012 Share Posted January 15, 2012 It's obviously stuck in the Do loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,You need to reverse the comparison if you use a Do...Until loop: $iBegin = TimerInit() Do $TestPixel = PixelSearch(302, 26, 817, 359, $PixelTest, 5) Until (Not @error) Or TimerDiff($iBegin) > 10000M23 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 Adergon, You need to reverse the comparison if you use a Do...Until loop: $iBegin = TimerInit() Do $TestPixel = PixelSearch(302, 26, 817, 359, $PixelTest, 5) Until (Not @error) Or TimerDiff($iBegin) > 10000 M23 Thank you Melba, it worked. But if im right, this command waits 10 seconds, and then finds the color, and stops. But i want it to search for the color, for 10 seconds and then stop if it doesn't find it. and then move on to next function. ThANks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,I am afraid you are wrong! Let us run through the code:- 1. We set a timestamp with TimerInit.- 2. We enter a Do loop- 3. We search for a colour with PixelSearch- 4. We now check the Until line:- 4A. If we find the colour @error = 0 so (Not @error) = 1 and we exit the loop (remember that AutoIt treats 0 as False and 1 as True) If we did not find the colour then @error = 1 so (Not @error) = 0 and we move on to check the comparison after the Or....- 4B. Here we use TimerDiff to see if more than 10secs have elapsed. If they have then we exit the loop - if not then neither part of the Until checks are true and so we loop again.All clear now? M23P.S. I would add a Sleep(10) in that loop or your CPU is going to get a bit hot with an almost permanent search. 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 (edited) Adergon, I am afraid you are wrong! Let us run through the code: - 1. We set a timestamp with TimerInit. - 2. We enter a Do loop - 3. We search for a colour with PixelSearch - 4. We now check the Until line: - 4A. If we find the colour @error = 0 so (Not @error) = 1 and we exit the loop (remember that AutoIt treats 0 as False and 1 as True) If we did not find the colour then @error = 1 so (Not @error) = 0 and we move on to check the comparison after the Or.... - 4B. Here we use TimerDiff to see if more than 10secs have elapsed. If they have then we exit the loop - if not then neither part of the Until checks are true and so we loop again. All clear now? M23 P.S. I would add a Sleep(10) in that loop or your CPU is going to get a bit hot with an almost permanent search. Sorry for wasting your time if you need to go, but hmm.. so this code: $iBegin = TimerInit() Do $TestPixel=PixelSearch(302, 26, 817, 359, 0xB9910F, 5) Until (Not @error) Or TimerDiff($iBegin) > 10000 MouseMove($TestPixel [0], $TestPixel [1]) MouseMove(15,3) It searches for the color, if it doesn't find it within 10 secs. it exits the loop and moves on to the next function/line. right? but i get an error in this code: Subscript used with non-Array variable. (Line 17) Edit: the last mousemove in end is to see if it exits the loops and moves on. ;P Edited January 15, 2012 by Adergon Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,You exit the loop on finding the colour or if the timer ran out. In the second case you will not have a valid coordinate array so you need to check if you have an array before trying to use it like this:$iBegin = TimerInit() $TestPixel = 0 ; Force the variable NOT to be an array Do $TestPixel = PixelSearch(302, 26, 817, 359, 0xB9910F, 5) Until (Not @error) Or TimerDiff($iBegin) > 10000 If IsArray($TestPixel) Then ; Check if have a valid array now MouseMove($TestPixel[0], $TestPixel[1]) EndIf MouseMove(15, 3)Got it? 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 Adergon, You exit the loop on finding the colour or if the timer ran out. In the second case you will not have a valid coordinate array so you need to check if you have an array before trying to use it like this: $iBegin = TimerInit() $TestPixel = 0 ; Force the variable NOT to be an array Do $TestPixel = PixelSearch(302, 26, 817, 359, 0xB9910F, 5) Until (Not @error) Or TimerDiff($iBegin) > 10000 If IsArray($TestPixel) Then ; Check if have a valid array now MouseMove($TestPixel[0], $TestPixel[1]) EndIf MouseMove(15, 3) Got it? M23 Melba is there anyway i can pay you?!?! omg thank you so much!!!! <33 :D:D Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,Melba is there anyway i can pay you?!?!You could perhaps donate something to help Jon pay the hosting costs - every little helps. 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...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 Adergon,You could perhaps donate something to help Jon pay the hosting costs - every little helps. M23I might actually, this is a good website with alot of people helping me in the past months. I will have a look into it Link to comment Share on other sites More sharing options...
Adergon Posted January 15, 2012 Author Share Posted January 15, 2012 close this please. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 15, 2012 Developers Share Posted January 15, 2012 We only close topics that are in violation with our rules or spin out of control. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Adergon,We do not "close" threads - unless you do something we do not like! If you want to add [solved] or similar to the title, just edit the first post and select the "Use Full Editor" option - that allows you to edit the title as well. 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...
water Posted January 15, 2012 Share Posted January 15, 2012 (edited) Please do not remove the title and text of the original post when solved! You take away important information for later reference.All the replies are meaningless without your question!Add [solved] at beginning of the title - that's all. This tells other users that there is a solution to the problem and might help them solve their own problem. Edited January 15, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 Title reset to something close to the original. Adergon,Please do not do this again - just add [sOLVED] to the title, not replace it. 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