If statements with OR operator

Is it possible to do an if statement that matches condition A OR condition B? Example: "If variable Path contains .jpg OR .jpeg"? Tried that, .jpg | .jpeg and a few other variants with no success so far.

Thanks!

(trying to avoid the more verbose solution of just adding another condition since that will make the macro very hard to read...)

For the example you specify, this seems to work fine for me:

36%20PM

Thanks Gabe. This didn't work for me, unfortunately, and would also like to do slightly more complex modifications (ie, treat .AAE and .HTM files in the same manner without having to duplicate whole chains of commands).

You're welcome, @orsini. Unfortunately, I can only guess as to why the method I showed you didn't work for you without seeing the macro in question. I'm also not sure exactly how your remark about slightly more complex modifications differs from your original question, as unless I'm missing something, the method I demonstrated should work for that use case too (albeit with a different regex, of course). If you haven't yet, I suggest reading this post and following its advice for your next post, as it will save you and anyone else who tries to help you a good amount of time:

Yes.

@gglick provided a RegEx solution, but here is another approach that provides a logical OR between conditions:

image

2 Likes

Awesome, thanks a bunch!

Found some time to work on the macro today. I'm now using the "Switch/Case" and each condition seems to require its own set of actions... Any tips for consolidation in this case? Thanks again

In this case, you can use either of the Switch Cases below:
image

Case#1:
(?i)\.(jpg|jpeg)$

Case#2:
(?i)\.jp.?g$

Both of these will match with LocalPath ending in either .jpg OR .jpeg, and are case insensitive.

1 Like

Great, thanks a ton!