Sign in to follow this  
Followers 0
Takeshi

How to 'Send' Random Key?

4 posts in this topic

#1 ·  Posted (edited)

Hello,

I am trying to make my AutoIt script send a random key between 1 to 5.

I have tried something along the lines of

set $x = Random (1,5,1)
Send ("{$x}")

but that doesnt work. Please help.

Edited by Takeshi

Share this post


Link to post
Share on other sites



'Inline' variable substitution is not enabled by default. The 'proper' way would be using the string concatenation operator:

Send("{"&Random(1,5,1)&"}")

In fact, from your example, I can infer you have not checked the documentation at all. There is no 'Set' keyword. To declare variables, you use Global, Local or Dim.

Share this post


Link to post
Share on other sites

Thank you.

In my autoit script, i haven't put set. I'm just use to typing set before a variable because of some other language. I havent made that mistake in my autoit scripts tho.

Share this post


Link to post
Share on other sites

Hello,

I am trying to make my AutoIt script send a random key between 1 to 5.

I have tried something along the lines of

set $x = Random (1,5,1)
Send ("{$x}")

but that doesnt work. Please help.

$x = Random (1,5,1)
Send ($x)

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  
Followers 0