Sign in to follow this  
Followers 0
autocomplex

Will this work?

6 posts in this topic

I Think this is it:

Case $msg = $StartButton OR $msg =  $MenuStart OR $msg = $MenuHotKeyStart
     Start()

Though i could be wrong, i couldn't find the reference to And/Or in the helpfile, though i am sure i have come across it before.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

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.

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