Jump to content

Recommended Posts

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
Posted

'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.

Posted

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.

Posted

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)

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
×
×
  • Create New...