Jump to content

Will this work?


Recommended Posts

  • Moderators

Will this work? All three do the same thing so I figured they could all be put in the same Case.

Case $msg = $StartButton, $MenuStart, $MenuHotKeyStart
            Start()
As long as it's in a Switch statement and you understand that the comma is an "Or".

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I Think this is it:

While 1
    $iRandom = Random(1, 10, 1)
    Switch $iRandom
        Case 1,2,3,4,5
            MsgBox(64, "1 through 5", $iRandom & " was randomly picked")
        Case 6,7,8,9,10
            MsgBox(64, "6 through 10", $iRandom & " was randomly picked")
    EndSwitch
WEnd

Edit:

Removed a comment from within the code...

What is wrong with the edit feature lately?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I am using Select and EndSelect, but I know Switch does basically the same thing. What are the most obvious differences between them, because I might just do Switch.

Switch + Value

Case Value1

EndSwitch

Select

Case $msg = Value

Case $othervar = Value

Case $otherVarVar = value

EndSelect

Switch is value specific... I prefer switch myself over Select even though it's not as versatile (less work, and I believe someone clocked it to be faster).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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