Sign in to follow this  
Followers 0
asgarcymed

About Syntax... How to do in order not to repeat $var= ?

7 posts in this topic

For example, I tried:

CODE

(...)

Case $var = "pdf" Or $var = "chm" Or $var = "pdb" Or $var = "djvu" Or $var = "rgo"

FileMove ($path & "\", path & "\eBooks-eArticles\", 8)

(...)

And I got the results I expected.

Next I tried:

CODE

(...)

Case $var = ("pdf" Or "chm" Or "pdb" Or "djvu" Or "rgo")

FileMove ($path & "\", path & "\eBooks-eArticles\", 8)

(...)

But the results were bad...

So I ask - How to do in order not to repeat $var= ?

I have about 30 rules ($var = ) - I am coding a file sorter/organizer...


MLMK - my blogging craziness...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

True

$var="dad"
Switch $var
    Case "mom", "dad",  "sister"
        MsgBox(0,"","Var is mom, dad or sister")
EndSwitch

False

$var="brother"
Switch $var
    Case "mom", "dad",  "sister"
        MsgBox(0,"","Var is mom, dad or sister")
EndSwitch

LIke that?

Edited by Nahuel

Share this post


Link to post
Share on other sites

$var="dad"
Switch $var
    Case "mom", "dad",  "sister"
        MsgBox(0,"","Var is mom, dad or sister")
EndSwitch
Nice example. Note that only works with Switch/Case/EndSwitch, not with Select/Case/EndSelect. OP doesn't actually say which he's using.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Nice example. Note that only works with Switch/Case/EndSwitch, not with Select/Case/EndSelect. OP doesn't actually say which he's using.

:P

OP? :)

And yeah, but they both do the same.. so there's no problem changing... right? ;)

Share this post


Link to post
Share on other sites

OP? :)

And yeah, but they both do the same.. so there's no problem changing... right? ;)

OP = "Original Post"

I didn't try it, but I don't think that syntax works with Select as it does with Switch. Did you do it?

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

This works - thank you!! I tested with "strings" (NOT 1, 2, 3.... numbers) :)

Best regards.


MLMK - my blogging craziness...

Share this post


Link to post
Share on other sites

==> Illegal text at the end of statement (one statement per line).: 
Select $var

What I meant was that they both do the same, but they have a different syntax. So moving from select to switch shouldn't be a big problem :)

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