April 13, 2021, 3:35pm
I'm using KM since a few days and I'm so absolutely addicted and want to thank all people that have realized such an awesome program. So to my question.
I want an automatic macro that detects a change in an input folder and move the PDF on the basis of its name to a specific folder.
For example a bill goes to the bill folder and a bank document to the bank folder.
I can do it with multiply "if" actions but i want to learn more elegant techniques for future macros.
Thank you for your help.
Switch statements are just about a direct upgrade from if statements
April 14, 2021, 6:57am
@vincent_ardern’s statement, I have long since stopped using nested if/then/else actions in favour of the much simpler and easier to maintain Switch action.
April 16, 2021, 5:21pm
Exactly what I was looking for! My macros are much simpler yet. Especially since I know to use the "OR" " | " symbol for multiple conditions.
April 16, 2021, 5:27pm
True. I didn't know the switch actions, but now I use it regularly. Thanks for answering!
Please explain. I don't see that documented anywhere.
April 18, 2021, 2:18pm
I have seen this "OR" condition from:
EXAMPLE: SWITCH action with "OR" conditions (copy-and-paste regular expressions)
I dont use his macro, but I just tried "|" between the condition and it worked!
Ah, thank you.
I was overthinking it. That's not a logical OR condition per se – it's the alternation operator of a regular expression. The regular expression in this case can be literal text or a regex pattern. (Technically the pipe separated literal text
is a regular expression.)
But it could be much more complex – like:
matches condition indicates the parameter is a regular expression.