Jump to content

Recommended Posts

Posted

Is it possible to have a few variables, then have the send command use 1 of the variables?

Example:

I want a variable that contains different colors such as... red, purple, green, blue, and orange.

Then I would use the send command...

Send( "The random color is... " & $random )

Now is there any way I can get $random to display a random color when the send command is run?

Thanks in advance ;)!

Posted

Heres how I would do it:

$random = Random(1, 5, 1)
If $random = 1 Then
   Send("blue")
ElseIf $random = 2 Then
   Send("red")
ElseIf $random = 3 Then
   Send("orange")
ElseIf $random = 4 Then
   Send("yellow")
Else
   Send("green")
EndIf
FootbaG
Posted

This might work a little better for you ;)

Dim $aColors[4] = ['blue', 'red', 'green', 'yellow']
$index = Random(0, UBound($aColors) - 1, 1)
MsgBox(0, $index, $aColors[$index])

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Posted (edited)

:P

I've been working with php lately (reworking a school site from pure html to simple php stuff), so I've had to work with easy modifications to the site (god bless csv files :mad2:). I guess it gets you thinking of how not to use if...then statements for every option ;)

Edited by MSLx Fanboy

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...