Jump to content

How to use StringLen?


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...