Sign in to follow this  
Followers 0
dnc86

Want to double-check If Variables are correct and limited by characters&numbers ? If not, want an error message box

1 post in this topic

Hi,

I am a beginner on AutoIT and sorry about asking very easy question like this, I appreciate all the support you give me on this road because I loved this thing.

I am trying to do some copy&paste options according to my Inputs with 3 different Inputs, but my problem is, I want to stop the script if the inputs are not correct like not numpherical or if ESC pressed, basicly I want to give commands like StringIsDigit&StringIsNumber,

But I a pretty sure my command structure is also not perfect, I actually want to do loops by step by step, any correctin and support is greatly appreciated.

What basicly I want is, If the $LoopNumber is not Digit Numbers than I want entire script to stop with an error, same goes for If $Tracking is not number and letters (Wondering if I can limit this variable by 14 characters total in case of pressing additional character to stop the script)

I want my script to double-check if we humans are smart enough to able to enter correct information to this beautiful system :)

Here is my code;

$First = 1$LoopNumber = InputBox("NUMBER OF TRACKINGS", "HOW MANY ITEMS")
$Tracking = InputBox ("TRACKING NUMBER", "ENTER THE TRACKING NUMBER" )
$Carrier = InputBox ("CARRIER NAME", "ENTER THE CARRIER NAME")

If StringIsDigit($LoopNumber) Then
    If StringIsAlNum($Tracking) Then


    While $First <= $LoopNumber
        Sleep(400)
        ClipPut($Tracking)
        Send("^v")
        Send("{TAB}")
        ClipPut($Carrier)
        Send("^v")
        Send("{ESC}")
        Send("{TAB}{TAB}{TAB}")
        $First += 1
    WEnd
Else
    MsgBox(0, "", "ITEM NUMBER IS NOT CORRECT, TRY AGAIN")
EndIf
EndIf

 

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