Jump to content

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


Zachlr
 Share

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)

WinActivate("Untitled - Notepad", "") ;activate notepad (or program of choice)

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

Link to comment
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)
    WinActivate("Untitled - Notepad", "");activate notepad (or program of choice)
    Send(Chr($randkeys));send
;the above function produces "A A A A"
    Sleep($rand);wait
WEnd;loop
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...