Hi, i'm freakin out with a simple script. I want to fill out form with entered previous string, but if its less then 6 characters, the last digit is multiplied, for example:
input: one,
output oneeee
or
input: 1
output: 111111
I tried this code, but the output string is only 2 characters long, and i dont know why
let>pass={"1"}
//check if length is correct
Length>%pass%,leng
If>leng [this > sign after 6 is not in code but i cannot paste it in other way]
MidStr>%pass%,%leng%,%leng%,last
label>leng2
let>%pass%=%pass%%last%
MessageModal>num: %leng%
let>leng=%leng%+1
MessageModal>num: %leng%
if>leng]
goto>leng2
endif
endif
Messages output always the same: first one num:1, second one num:22, so the last character is added only once. I dont get it. Please heeeelp
string lenght problem
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Neater:
Or if you want to be clever and briefer:
Code: Select all
let>pass=1
//check if length is correct
Length>pass,leng
If>leng<6
MidStr>pass,leng,1,last
Repeat>leng
Concat>pass,last
Let>leng=leng+1
MessageModal>num: %leng% password: %pass%
Until>leng=6
endif
MessageModal>final password: %pass%
Code: Select all
VBSTART
VBEND
let>pass=1
VBEval>"%pass%" & string(6 - len("%pass%"), Mid("%pass%",len("%pass%"),1)),pass
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?