Jump to content
Sign in to follow this  
Baronello

How to use StringLen?

Recommended Posts

Baronello

Im trying to make my first script and failing with any syntaxis i tryed. Help with code please. ;)

$num = 0

Do
sleep(500)
Send($num)
$num+=1
StringLen($num) = a
sleep(500)
Send("{Enter}")
sleep(500)
if a = 1 then
Send("{Backspace}")
if a = 2 then
Send("{Backspace}")
Send("{Backspace}")
if a = 3 then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
if a = 4 then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
if a = 5 then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Until $num = 11111

$num = 0
Do
sleep(500)
Send($num)
$num+=1
sleep(500)
Send("{Enter}")
sleep(500)
if $num = StringLen(1) then
Send("{Backspace}")
if $num = StringLen(2) then
Send("{Backspace}")
Send("{Backspace}")
if $num = StringLen(3) then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
if $num = StringLen(4) then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
if $num = StringLen(5) then
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Send("{Backspace}")
Until $num = 11111

Share this post


Link to post
Share on other sites
Baronello

Ye my friend allready told me this, thx. <3 Im dumb in coding. ._.

So which syntaxis for StringLen right then?

Share this post


Link to post
Share on other sites
stormbreaker

StringLen is used to get the length of a string. Example:

- stringlen('mkish') returns 5

if you want to get length of a no. Then use it like stringlen('' & $number)

I suggest using switch-case rather than if endif.


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites
Baronello

Thx, get it working. <3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×