jebus495 Posted February 2, 2009 Share Posted February 2, 2009 (edited) Func calibratex () $xadd = 705 Do $xadd = $xadd + 1 $xscan1 = PixelGetColor ($xadd, 300) Until $xscan1 = 0x000000 Or $xadd = 750 If $xscan1 = 750 Then MsgBox (0, "ERROR!", "winmovex cannot be found.") Exit EndIf IniWrite("NAMEOFINI.ini","Account","winmovex","" & ($xadd - 730) * -1 & "") MsgBox (0, "FOUND winmovex!", "winmovex = " & ($xadd - 730) * -1 & "") checky() EndFunc This works exactly as I need it to with the exception of one slight problem. It doesn't stop @ 750 like I thought it would. Maybe "Or" operator doesn't work like I think it should? Maybe For To Next would be appropriate? =S Edited February 2, 2009 by jebus495 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2009 Moderators Share Posted February 2, 2009 jebus495,Do...Until works fine, but perhaps if you changed the line after from If $xscan1 = 750 Then to If $xadd = 750 Then you might see the MsgBox!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...
Authenticity Posted February 2, 2009 Share Posted February 2, 2009 It'll loop until one of these statements evaluated as true, you might want to use And instead, Make sure it'll not make an infinite loop because it can easily make an infinite loop like that... Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 2, 2009 Share Posted February 2, 2009 how bout in the loop if $xadd = 750 then exitloop Giggity Link to comment Share on other sites More sharing options...
rudi Posted February 2, 2009 Share Posted February 2, 2009 Hi. It's working for me: $xadd=1 Do if $xadd = 750 then ConsoleWrite("Missed to exit" & @CRLF) Exit EndIf $xadd +=1 $xscan1 = PixelGetColor ($xadd, 300) Until $xscan1 = 0x123456 Or $xadd = 750 ConsoleWrite($xscan1 & ", " & $xadd & @CRLF) Run the script from SciTE Editor and watch the output in the bottom pane. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
jebus495 Posted February 2, 2009 Author Share Posted February 2, 2009 It'll loop until one of these statements evaluated as true.That's what I wanted! TY.I just noticed something silly...If $xscan1 = 750 Then MsgBox (0, "ERROR!", "winmovex cannot be found.") ExitEndIfLol. xscan1 will never be a number lol. Now I feel dumb lol. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 2, 2009 Share Posted February 2, 2009 How do you think we feel? none of us noticed it Giggity Link to comment Share on other sites More sharing options...
jebus495 Posted February 2, 2009 Author Share Posted February 2, 2009 (edited) How do you think we feel? none of us noticed it Hah. It took me so long to work out "& ($xadd - 730) * -1 &" that I guess I didn't have enough brain power to see something that simple. Just in case anyone was curious this works exactly how I wanted it to. Func calibratex () $xadd = 704 Do $xadd = $xadd + 1 $xscan1 = PixelGetColor ($xadd, 300) Until $xadd = 750 Or $xscan1 = 0x000000 If $xadd = 750 Then MsgBox (0, "ERROR!", "winmovex cannot be found.") Exit EndIf IniWrite("NAMEOFINI.ini","Account","winmovex","" & ($xadd - 730) * -1 & "") MsgBox (0, "FOUND winmovex!", "winmovex = " & ($xadd - 730) * -1 & "") checky() EndFunc Edited February 2, 2009 by jebus495 Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 2, 2009 Share Posted February 2, 2009 so by switching them does it stop at $xscan1 = 0x000000? Giggity Link to comment Share on other sites More sharing options...
jebus495 Posted February 2, 2009 Author Share Posted February 2, 2009 (edited) so by switching them does it stop at $xscan1 = 0x000000?Yes.I'm guessing it goes like this.Situation 1Does xadd = 750? Nope (Checks the next one)Does xscan1 = 0x000000? Nope (Start loop over)Situation 2Does xadd = 750? Yes (Exits loop and doesn't bother checking xscan)Situation 3Does xadd = 750? Nope (Checks the next one)Does xscan1 = 0x000000? Yes (Exits loop)Unless I have misunderstood this. Edited February 2, 2009 by jebus495 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