check number and text

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

check number and text

Post by timle » Thu Nov 15, 2007 11:54 pm

I want to make sure the date of the file I get are two digits, if the dates send in as one digit, it will stop the script.
but I dont know how to make the script distinguish bettween number and text.


Let>orgfile=11-20Name
//if I get the file with one digit "1-20Name" the script ends
MidStr>%orgfile%,1,1,ONEDIGITMONTH
If>%ONEDIGITMONTH%=-,END
//if I get the file with one digit "10-2Name" the script ends
MidStr>%orgfile%,5,1,ONEDIGITDATE
If>%ONEDIGITDATE%=(NOT A NUMBER),END

label>END

The month works, but I dont know how to do the date

thanks

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Nov 16, 2007 2:55 am

While I have no idea what you are actually trying to accomplish, here is one way to distinguish between Alpha and Numeric.

let>ValidNum=0123456789
let>SomeString=1234K5678
MidStr>%SomeString%,5,1,SearchThis
Pos>SearchThis,ValidNum,1,CheckThis
if>CheckThis>0
mdl>%SearchThis% is numeric
else
mdl>%SearchThis% is Alpha
endif

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Nov 16, 2007 4:15 am

Here's another number test based on looking at the ASCII code for the character:

VBstart
VBend
Let>SomeString=1234K5678
MidStr>%SomeString%,5,1,testchar
VBEval>Asc("%testchar%"),testasc
If>{(%testasc% >=48) AND (%testasc% It's a number
Else
MDL>It's not a number
Endif

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts