Iterating through a string beginning with character '0'

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Iterating through a string beginning with character '0'

Post by madcyborg » Tue Nov 15, 2022 8:55 pm

[snippet=]
// Control speed of printing the clipboard
Let>delay=.5

Getclipboard>clipboard
Let>clipboard_size={length(%clipboard%)}

Let>iterator=0
While>iterator<%clipboard_size%
let>SK_IGNORECAPS=1
Let>clipboard_text={copy(%clipboard%,%iterator%,1)}
sendtext>%clipboard_text%
let>iterator=iterator+1
Wait>%delay%
endwhile
[/snippet]

One of the most irritating things on the Internet is not being able to fill out web forms because they disable the paste functionality. This is my workaround, but there is something wrong when the clipboard begins with the character 0.

Rephrased, if you copy 01234 to the clipboard, it registers string length 4 in the debug! And sure enough, when it prints the characters, it omits 0.

Using an input of 1234 does not produce the same effect and registers the same length of 4.

Is this a bug? I'm including screenshots. MCS 15, Windows 10.

Image
Image

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Iterating through a string beginning with character '0'

Post by Dorian (MJT support) » Tue Nov 15, 2022 9:30 pm

Try this :

Code: Select all

putclipboard>01234
// Control speed of printing the clipboard
Let>delay=.5
Getclipboard>clipboard
len>clipboard,clipboard_size

Let>iterator=0

While>iterator<%clipboard_size%
  let>SK_IGNORECAPS=1
  let>iterator=iterator+1
  MidStr>clipboard,%iterator%,1,clipboard_text
  sendtext>%clipboard_text%
  Wait>%delay%
endwhile
Also, just in case you're not aware and in case this helps, you can set a SendText character delay (in milliseconds) with sk_delay.

Code: Select all

putclipboard>01234
getclipboard>clipboard

let>sk_delay=500
send>%clipboard%
Yes, we have a Custom Scripting Service. Message me or go here

madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Re: Iterating through a string beginning with character '0'

Post by madcyborg » Tue Nov 15, 2022 10:16 pm

Thanks, that works.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts