Jump to content
Sign in to follow this  
Diana (Cda)

If ... else ... but adding a condition (?)

Recommended Posts

Diana (Cda)

I can manage some If conditions now but if more than a couple of conditions need to be met, still getting myself into a mess <g>.

I have a script that opens a folder on the hdd _and_ on the USB flash drive, if the memory stick is plugged in. To make it a tad more challenging, I don't like Windows Explorer so have a WE replacement to open folders. Since I like to overcome errors right from the get-go, one condition is to open with WE _if_ the replacement isn't available for whatever reason (i.e., after a wipe/reinstall and I haven't yet installed the replacement). But I don't know how to prevent the scripts from popping up a couple of error boxes if another condition isn't met, when the memory stick isn't plugged in. When the USB flash drive isn't available, the script should just ignore that command and close. That's where I'm stumped though. Here's the pertinent part of these types of scripts:

If FileExists($WEReplacement) AND FileExists($FldrToOpenUFD) THEN
    ShellExecute($WEReplacement, $FldrToOpenUFD, "", "open", @SW_MAXIMIZE)
    ShellExecute($FldrToOpenUFD, "", "", "open", @SW_MAXIMIZE)

I tried adding an Else If condition, as per the help file and putting in an exit code but couldn't get that to work.

Thanks for any help re this! :)

Share this post

Link to post
Share on other sites

if $statement=true and $statement2=true then
;do whatever
elseif $statment=true and $statement2=false then
;do somethingelse
elseif $statment=false and $statement2=true then
;do another thing
;do another thing if none of the above conditions are met

Edited by Aceguy

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