001 + 1 = 2 not 002 :(

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mykeasaurus
Newbie
Posts: 7
Joined: Thu Sep 01, 2005 2:10 am

001 + 1 = 2 not 002 :(

Post by mykeasaurus » Thu Sep 01, 2005 2:18 am

I have a variable that is defined as 001 in a text file. every time my program runs it ads 1 to the variable. I need it to make it 002, but instead it turns the variable into just 2, removing the zeros. Ive tried adding 001, that didnt work. I cant add the zeros separate cause it will eventually become 010 and so on..

heres what im doing:

ReadIniFile>C:\Test\hello.txt,Ks,Number,id
Let>id=%id%

Let>%id%=%id%+001
Send>%id%


anyone know how to fix this?
thanks!

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

Post by Me_again » Thu Sep 01, 2005 2:47 am

Support posted an elegant bit of code in another thread that you should be able to use. I adapted it a bit to generate a 3 digit number with leading zeroes.

Let>idnum=1
Let>idnum=00%idnum%
Let>idnum={copy("%idnum%",length("%idnum%")-2,3)}
MessageModal>%idnum%

If you test it with 1, 10, 100 you will see that it works very nicely yielding 001 010 100

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