Page 1 of 1

TextEntry string count and expand

PostPosted: Sat Sep 30, 2017 1:44 pm
by Dudus
Hi,

i have a Text Entry with 20 char place, I need to count the entered words and if the word is less than 20 char for example only 5 char
than word+15char with space like this:

Yesss_______________ (ofcourse _ now is space)

How to do that?
Thanks!
Dudus

Re: TextEntry string count and expand

PostPosted: Sat Sep 30, 2017 6:36 pm
by Gaev
Dudus:

Try this ...
Code: Select all
... append with spaces to make length of 20 characters
... assumes that string will always be <= 20

... calculate required spaces
StrLen "[TextEntry20]" "[TextEntry20Len]"
Math "20-[TextEntry20Len]" "0" "[RequiredSpaces]"

... make string of required spaces
SetVar "[TwentySpaces]" "                    "
...SetVar "[TwentySpaces]" "12345678901234567890"
SubStr "[TwentySpaces]" "1" "[RequiredSpaces]" "[RequiredSpacesText]"

... append
SetVar "[RequiredText]" "[TextEntry20][RequiredSpacesText]"

... verify
StrLen "[RequiredText]" "[RequiredTextLen]"
AlertBox "Results" "[TextEntry20Len] ... [RequiredSpaces] ... [RequiredTextLen] ... <[RequiredText]>"

Re: TextEntry string count and expand

PostPosted: Sun Oct 01, 2017 10:24 am
by Dudus
Hello Gave!

Works perfect... :) Thank you verry much!

Dudus