Sign in to follow this  
Followers 0
jbwhite

Separating numeric from everything else

8 posts in this topic

#1 ·  Posted (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 by jbwhite

Share this post


Link to post
Share on other sites



have a look at isnumber() and possibly use with an if statement


Drunken Frat-Boy Monkey Garbage

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

wait...

Edited by jbwhite

Share this post


Link to post
Share on other sites

Alright, I got it with StringIsDigit() after struggling with IsNumber(), and googling IsNumber(), which led me to StringIsDigit()

weeee

but thanks for the help.

Share this post


Link to post
Share on other sites

eventually i will use gui's and that certainly sounds straightforward, just want to build up a better working knowledge of autoit first

1 person likes this

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

See this func by ProgAndy as it mimics the old Int() behavior

Edited by MilesAhead

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0