Jump to content

Random problems


Recommended Posts

I am not sure why this is not working.

I am trying to select one of three options, each one has a shortcut that I am trying to send. The shortcuts are 'alt & a', 'alt & w' and 'alt & m'. I need to send this randomly.

My script won't run with this piece of code, if I comment it out it is fine. I have even tried specifying different variable names, with no luck. Any ideas?

$y = Random(1, 3, 1)
   If $y = 1 Then
      $x = "a"
   ElseIf $y = 2 Then
      $x = "w"
   ElseIf $y = 3 Then
    $radio = "m"
   EndIf
   Send("!" & $x & ")
Edited by Katy
Link to comment
Share on other sites

With a couple of minor changes, make work fine

Working example

$y = Random(1, 3, 1)
MsgBox(0, '', $y)
If $y = 1 Then
    $x = "f"
ElseIf $y = 2 Then
    $x = "e"
ElseIf $y = 3 Then
    $x = "o"
EndIf
Run('notepad')
WinWaitActive('Untitled')
Send("!" & $x); <-- Notice this
Link to comment
Share on other sites

With a couple of minor changes, make work fine

Working example

Send("!" & $x); <-- Notice this

<{POST_SNAPBACK}>

Thanks alot. I finally found my error very late that night...I had changed one of my variable names when I 'Sent' it. :">

Thanks for the tips though I have been using this shorter method alot now :(.

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