Scriptkiddi3 Posted October 17, 2005 Share Posted October 17, 2005 Hi guys! I have a problem. If I use this code the program keeps on looping, while $a, $b and $c are all numbers. Do $a=Inputbox("Functie invullen", "Geef een waarde voor a") $b=Inputbox("Functie invullen", "Geef een waarde voor b") $c=Inputbox("Functie invullen", "Geef een waarde voor c") Until IsNumber($a) And IsNumber($b) And IsNumber($c) Hope that you can tell me what I did wrong this time? ty [-"Scriptkiddie, nice to meet you!"-] Link to comment Share on other sites More sharing options...
scriptkitty Posted October 17, 2005 Share Posted October 17, 2005 (edited) Usually inputbox by its nature returns text, even if the text is a number. You might try a test like if $x=int($x) then or something like that. ...edit " something like that" would be if $x=number($x) then Edited October 17, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Scriptkiddi3 Posted October 17, 2005 Author Share Posted October 17, 2005 Usually inputbox by its nature returns text, even if the text is a number.You might try a test like if $x=int($x) thenor something like that.Int(4.56) = 4 .... won't work [-"Scriptkiddie, nice to meet you!"-] Link to comment Share on other sites More sharing options...
seandisanti Posted October 17, 2005 Share Posted October 17, 2005 Hi guys!I have a problem. If I use this code the program keeps on looping, while $a, $b and $c are all numbers.Do $a=Inputbox("Functie invullen", "Geef een waarde voor a") $b=Inputbox("Functie invullen", "Geef een waarde voor b") $c=Inputbox("Functie invullen", "Geef een waarde voor c") Until IsNumber($a) And IsNumber($b) And IsNumber($c)Hope that you can tell me what I did wrong this time? tyyou could just explicitly typecast it...Do $a=Number(Inputbox("Functie invullen", "Geef een waarde voor a")) $b=Number(Inputbox("Functie invullen", "Geef een waarde voor b")) $c=Number(Inputbox("Functie invullen", "Geef een waarde voor c"))Until IsNumber($a) And IsNumber($ And IsNumber($c) Link to comment Share on other sites More sharing options...
scriptkitty Posted October 17, 2005 Share Posted October 17, 2005 (edited) Sorry, not hinking striant. while 1 $num1=InputBox("test number","test","6") if $num1==number($num1) then msgbox(1,"Numbertest", $num1 & " is number") Else msgbox(1,"Numbertest", $num1 & " is not a number") EndIf WEnd Hope that helps. Do $a=Inputbox("Functie invullen", "Geef een waarde voor a") $b=Inputbox("Functie invullen", "Geef een waarde voor b") $c=Inputbox("Functie invullen", "Geef een waarde voor c") Until ($a==number($a) And $b==number($b) And $c==number($c)) ..edit forgot a ( Edited October 17, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Scriptkiddi3 Posted October 18, 2005 Author Share Posted October 18, 2005 (edited) Do $a=Inputbox("Functie invullen", "Geef een waarde voor a") $b=Inputbox("Functie invullen", "Geef een waarde voor b") $c=Inputbox("Functie invullen", "Geef een waarde voor c") Until (StringIsInt($a) Or StringIsFloat($a)) And (StringIsInt($b) Or StringIsFloat($b)) And (StringIsInt($c) Or StringIsFloat($c))This works fine, even with "2/3" or something.Do $a=Inputbox("Functie invullen", "Geef een waarde voor a") $b=Inputbox("Functie invullen", "Geef een waarde voor b") $c=Inputbox("Functie invullen", "Geef een waarde voor c") $a = Number($a) $b = Number($b) $c = Number($c) Until (StringIsInt($a) Or StringIsFloat($a)) And (StringIsInt($b) Or StringIsFloat($b)) And (StringIsInt($c) Or StringIsFloat($c))Thanks for your help *EDIT: Not working... If $a = "k", Number($a) = 0 I would think that something like this isn't complicated to script at all Edited October 18, 2005 by Scriptkiddi3 [-"Scriptkiddie, nice to meet you!"-] 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