jbwhite Posted January 20, 2012 Share Posted January 20, 2012 (edited) Searched google and this forum, couldn't find an answer. Note; autoit is the only scripting I've ever done in my life, if it sounds like I know nothing about this, it's quite simple, I don't. I have written a simple little script to change the volume when given a percentage (0-100). It works great, no problems. It uses inputbox to ask for a percent that is inputed and it changes the volume to that. No problems. However, I want to specify that the value entered cannot be anything but numeric, ei, I have written it so that if you input anything greater than 100 or less than 0 a msgbox will pop up (saying "you dun' goofed" - approx.) and nothing will happen, script exits. Beautiful. So how do I write it to say that if $box (my var) is not a number, then I can make another msgbox pop up and say something along the lines of "use numbers ya idiot" Does that make sense? Thanks in advance. Edited January 20, 2012 by jbwhite Link to comment Share on other sites More sharing options...
engjcowi Posted January 20, 2012 Share Posted January 20, 2012 have a look at isnumber() and possibly use with an if statement Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
jbwhite Posted January 20, 2012 Author Share Posted January 20, 2012 (edited) wait... Edited January 20, 2012 by jbwhite Link to comment Share on other sites More sharing options...
jbwhite Posted January 20, 2012 Author Share Posted January 20, 2012 Alright, I got it with StringIsDigit() after struggling with IsNumber(), and googling IsNumber(), which led me to StringIsDigit() weeee but thanks for the help. Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 Instead of using InputBox, you could have created a GUI with a style value $ES_NUMBER which only allows digits to be entered into it. BrewManNH 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jbwhite Posted January 20, 2012 Author Share Posted January 20, 2012 eventually i will use gui's and that certainly sounds straightforward, just want to build up a better working knowledge of autoit first JohnOne 1 Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 Commendable standpoint. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MilesAhead Posted January 20, 2012 Share Posted January 20, 2012 (edited) See this func by ProgAndy as it mimics the old Int() behavior Edited January 20, 2012 by MilesAhead My Freeware Page 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