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!
001 + 1 = 2 not 002 :(
Moderators: JRL, Dorian (MJT support)
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
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
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