ojef1 Posted March 2, 2011 Share Posted March 2, 2011 If ($row>0) And ($lastRow>0) And ($lastRow >= $row) Then ExitLoop Else MsgBox(48, "ERROR", "You must enter a valid integer and the last rows gotta be greater than or equal to the first row." EndIf This statement evaluates to true no matter what I input. Link to comment Share on other sites More sharing options...
Mobius Posted March 2, 2011 Share Posted March 2, 2011 (edited) ~ Edited March 2, 2011 by Mobius Link to comment Share on other sites More sharing options...
ojef1 Posted March 2, 2011 Author Share Posted March 2, 2011 expandcollapse popupFunc input() While 1 GUICreate("Emax", 380, 180, @DesktopWidth / 4 - 160, @DesktopHeight / 4 - 45, -1, 0x00000018) GUICtrlCreateLabel("Enter the row to start with: ", 10, 5) $input1 = GUICtrlCreateInput("", 10, 25, 100, 20) GUICtrlCreateLabel("Enter the last row: ", 10, 50) $input2 = GUICtrlCreateInput("", 10, 65, 100, 20) GUICtrlCreateLabel("Enter a time delay (in milliseconds) in case the network is running slow: ", 10, 90, 350, 20) $input3 = GUICtrlCreateInput("", 10, 105, 100, 20) ;slows whole program down $enterBtn = GUICtrlCreateButton("Enter", 20, 145, 60, 20) $cancelBtn = GUICtrlCreateButton("Cancel", 100, 145, 60, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit ElseIf $msg = $enterBtn Then $row = Int(GUICtrlRead($input1, 1)) $lastRow = Int(GUICtrlRead($input2, 1)) $delay = Int(GUICtrlRead($input3, 1)) ExitLoop ElseIf $msg = $cancelBtn Then Exit EndIf WEnd If ($row>0) And ($lastRow >= $row) Then ExitLoop Else MsgBox(48, "ERROR", "You must enter a valid integer and the last rows gotta be greater than or equal to the first row." EndIf WEnd EndFunc This is the full function (you make a valid point Mobius)...but no matter what the inputs are I can't get to the error message Link to comment Share on other sites More sharing options...
BrewManNH Posted March 2, 2011 Share Posted March 2, 2011 Adding a couple of lines to make this a usable demo script, without changing your code at all, it works for me if I put in 0 for $row, or if $lastRow < $row. I get the MsgBox when I do that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
ojef1 Posted March 2, 2011 Author Share Posted March 2, 2011 That's wierd it works for me now too...I kept entering 'a' in all 3 textboxes and it still exited the loop and bypasses the error message. I can't imagine Mobius' suggestion fixed the problem, even though it was an improvement.....who knows thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 2, 2011 Share Posted March 2, 2011 When you enter a string in a native AutoIt parameter that expects an integer, it gets put through Number() first. Since "a" is not a number string, it evaluates to 0. Entering "a" for every integer value is the same as entering 0 for all of them. It works the same for numeric compare operators like "=", ">", or "<=". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
jchd Posted March 2, 2011 Share Posted March 2, 2011 You probably should make the input fields $ES_NUMBER as you only allow numeric values. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
michaelslamet Posted March 2, 2011 Share Posted March 2, 2011 If ($row>0) And ($lastRow>0) And ($lastRow >= $row) Then ExitLoop Else MsgBox(48, "ERROR", "You must enter a valid integer and the last rows gotta be greater than or equal to the first row." EndIf This statement evaluates to true no matter what I input. Try this: If (number($row)>0) And (number($lastRow)>0) And (number($lastRow) >= number($row)) Then 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