# Send("{ASC/II n}") isn't working

## Recommended Posts

I'm trying to create a simple script to send a random character on a random interval. Everything works fine except that the character isn't random, or even within the range of the random number generator. What I mean by that is I use: Random(66, 122, 1) and send it using Send("{ASC/II \$randkeys}") and the resulting character is "A", but A = 65 in ASCII. I thought at first it was because it had to be 066 instead of 66, but i tried it both ways and it still produced "A". The same thing happened for 067, 67, 68, 068 etc. The same thing also happened for Send("{ASC/II & \$var}") as with Send("{ASC/II \$var}") Can you even use a variable in it?

My code so far:

While 1 ;loop

\$rand = Random(50, 5000, 1) ;generate random wait time

\$randkeys = Random(66, 122, 1) ;generate random ASCII number.

;I tried also using: \$randkeys = Random(100, 122, 1)

Send("{ASC \$randkeys} {ASC & \$randkeys} {ASCII \$randkeys} {ASCII & \$randkeys}") ;send

;the above function produces "A A A A"

Sleep(\$rand) ;wait

WEnd ;loop

Thanks,

Zach

##### Share on other sites

Lookup Send in the helpfile, and look at what {ASC} does. Or hold ALT and press 65 on your Numpad... that's what you are doing.. use Chr() instead.

```While 1;loop
\$rand = Random(50, 5000, 1);generate random wait time
\$randkeys = Random(66, 122, 1);generate random ASCII number.
;I tried also using: \$randkeys = Random(100, 122, 1)
Send(Chr(\$randkeys));send
;the above function produces "A A A A"
Sleep(\$rand);wait
WEnd;loop```

##### Share on other sites

It works great now. Thanks!

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...