igmeou Posted March 14, 2005 Share Posted March 14, 2005 Hi, Is there a way for me to use inputbox function to get number instead of string? Func askNumber($question) $answer = InputBox ("Please answer the question", $question);can use for string only ;Return 0 for invalid input and not a number If @error > 0 Then Return 0 EndIf Return GUICtrlRead ($answer) EndFunc I need the code above to ask a user to input a number and then return it to the main function. Oh and I'm using onEvent mode for this program. Anyone please? [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever) Link to comment Share on other sites More sharing options...
CyberSlug Posted March 14, 2005 Share Posted March 14, 2005 ; force result to be treated like a number $answer = Number($answer) Be sure to do that AFTER you check the @error value of InputBox Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
igmeou Posted March 14, 2005 Author Share Posted March 14, 2005 (edited) Thanks slug. I works now! Thanks! Actually I had try Return Number(GUICtrlRead ($answer)) but this don't work. Any reason for this?? Ok. Now I finally release my mistake. I trying to get the controlID instead of the data. Edited March 14, 2005 by igmeou [font="Arial"]Thanks[/font]If @error = me Then $sorry Else Do $clarifyMe Until $meClear EndIF MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever) 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