Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Determine if there's an Alpha in my Numeric



  • Please log in to reply
2 replies to this topic
Bartimus
  • Members
  • 237 posts
  • Last active: Nov 10 2016 05:01 PM
  • Joined: 10 Nov 2005

What's the easiest way to determine if a user input variable contains a letter.

I only want users to type numbers in an INPUTBOX and want them to reenter again if a letter is mixed in with the numbers.

 

example of what I don't want:        2349G052

example of what should be there: 23496052



G. Sperotto
  • Members
  • 539 posts
  • Last active: Jun 20 2015 04:54 PM
  • Joined: 12 Dec 2011
✓  Best Answer

You can check the contents of a variable with If [var] is not type.

 

Example below

GO:
inputbox, RESULTS
if RESULTS is not number
{
    msgbox, 0x10, Error, The input value is not a number, please enter it again.
    Goto, GO
}
msgbox, You have correctly entered a number.
Goto. GO
Return

"What is a suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!


Bartimus
  • Members
  • 237 posts
  • Last active: Nov 10 2016 05:01 PM
  • Joined: 10 Nov 2005

I knew there was a command (or in this case logic statement) that did this, just never could remember.

Thanks G. Sperotto