Sign in to follow this  
Followers 0
BreCalmor

Choose?

6 posts in this topic

Is there something in AutoIt like the VB function:

Choose(index, choice-1[, choice-2, ... [, choice-n]])

Thanks,

Bre

Share this post


Link to post
Share on other sites



Plenty.

All depends what it is that you want to accomplish.

Local $Binne[7] = ["Su", "Mon", "Tue", "We", "Th", "Fr", "Sa"]
For $s = 1 To 7

    MsgBox(64, "Index no: " & $s, " Inside of $Binne [" & $s - 1 & "] is ===> " & $Binne[$s - 1], .5); array starts @ 0

Next

Share this post


Link to post
Share on other sites

Switch <expression>
    Case <value> [To <value>] [,<value> [To <value>] ...]
        statement1
        ...
    [Case <value> [To <value>] [,<value> [To <value>] ...]
        statement2
        ...]
    [Case Else
        statementN
        ...]
EndSwitch

Parameters

<expression> An expression that returns a value. The value from the expression is then compared against the values of each case until a match is found. This expression is always evaluted exactly once each time through the structure.

<value> To <value> The case is executed if the expression is between the two values.

<value> The case is executed if the expression matches the value.

Remarks

If no cases match the Switch value, then the Case Else section, if present, is executed. If no cases match and Case Else is not defined, then none of the code inside the Switch structure, other than the condition, will be executed.

Switch statements may be nested.

Taken straight from the help file. hope its helpful


http://twentylinesofcode.blogspot.comLittle apps n crap. can be fun

Share this post


Link to post
Share on other sites

Trying to do a function (If...Next, Switch, or Select) in-line in another function.

Since I didn't see a Choose function, I just used a Select. I would like to clean up the code, but I guess a Choose or IIF type function isn't out there.

Thanks for the ideas,

Bre

Share this post


Link to post
Share on other sites

#include <misc.au3>

MsgBox(4096, "Iif function demo", "It's " & _Iif(@HOUR < 12, "fore", "after") & "noon")

Share this post


Link to post
Share on other sites

you can use multiple if statements.. hers a rough example

if $var1 = "0" then

blah blah blah

if $var2 = "1" then

blah blach

endif

endif

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