d4rk Posted April 11, 2008 Share Posted April 11, 2008 2, i've these code to compare if the $number2 is bigger then $number1, everything works fine until i give the $number1 = 9 ... and whatever the $number2 is, its also think the $number1 is the biggest do $number1=InputBox("compare","Number 1","","",100,100) until $number1<>"" and StringIsDigit($number1) do $number2=InputBox("compare","Number 2","","",100,100) until $number2<>"" and StringIsDigit($number2) and $number2 > $number1 [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 11, 2008 Share Posted April 11, 2008 (edited) Numbers stored as string datatypes won't return proper results where used in math-type comparison operators. Also, InputBox can error-out, so we do some error checking: Try this: do $number1=InputBox("compare","Number 1","","",100,100) If @Error Then ContinueLoop until $number1<>"" and StringIsDigit($number1) do $number2=InputBox("compare","Number 2","","",100,100) If @Error Then ContinueLoop $num002 = Number($number2) $num001 = Number($number1) until $number2<>"" and StringIsDigit($number2) and $num002 > $num001 Edited April 11, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Aceguy Posted April 11, 2008 Share Posted April 11, 2008 global $number1,$number2 $number1=InputBox("compare","Number 1","","",100,100) $number2=InputBox("compare","Number 2","","",100,100) $number1=Number($number1) $number2=Number($number2) if $number1<>"" and StringIsAlNum($number1)=1 Then if $number2<>"" and StringIsAlNum($number2)=1 Then ConsoleWrite("1 "&$number1&" "&"2 "&$number2) if $number1 < $number2 Then MsgBox(0,"","$1 is less than $2",0) if $number1 > $number2 Then MsgBox(0,"","$1 is greater than $2",0) EndIf EndIf only until i added $number2=Number($number2) then it worked, i dunno why, but might because $number is a string not a number? [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
d4rk Posted April 11, 2008 Author Share Posted April 11, 2008 thanks both ! [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys 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