Help with conditional logic

Well, i would have thought this would have been a bit simple. I am simply trying to create folders names based one 1 of 2 conditions. Condition 1 is "Is this a stills folder" (Value=Stills) or "Is this a Video folder" (Value=Video). Attached are the screen shots of the area of the macro that has the logic and when I click the "Video" check box in the user input dialog it still creates folders for Stills.

What am I doing wrong?


Try this:

Create Stills / Video Folder Macro (v10.1.1)

Create Stills - Video Folder.kmmacros (21 KB)


I'm assuming you have the dropdown options set to have your prompt window look like this:

If you select the Video option, the value of the video variable will be 1, not "Video". That's why your If action is always taking the "otherwise" path.

But don't change your logic to look for 1 instead of "Video". Checkboxes are not meant to be used for mutually exclusive options because clicking one does not unclick the other. Instead, either use a popup menu as @noisneil suggested or set up the buttons along the bottom of the window to make the choice:

Here's a demo macro with that prompt:

Prompt test.kmmacros (5.9 KB)

Image of Prompt test macro

1 Like

I'll throw a third option into the mix. You could just have a button for Video. If you don't click it, it defaults to Stills. you...

CleanShot 2022-06-19 at 03.15.29

Also, and I may be mistaken, the Insert text by pasting actions give me the impression you're creating a folder and then renaming it. A neater way to do this is to create a new folder named using the existing variables, like this:

The text inside the first Create new folder action is:

%FinderInsertionLocation%/%Variable%Local__Folder Name% - TL 1 processed

This creates a folder in the current finder directory like this:

CleanShot 2022-06-19 at 03.19.45

Of course, you can change it to be formatted however you like.

1 Like

Thanks to the both of you. The suggestions and quick reply are GREATLY appreciated. I am sure there is a better way to do what I am trying to do but I am not all that great at KM to begin with. So I am using keystrokes to do all of this.

I did however end up using the "buttons along the bottom" method and it works great.

I am sure I would be better off using code rather than keystrokes to do all of this but I am not privy to all the commands needed to write the code.

Noisneail, looking at your solution I see `%FinderInsertionLocation%/%Variable%Local__Folder Name% and I have no idea what that means or does in my situation but it reads as if it is a better solution than what I am using.

complete macro below.

I am starting the macro after I have selected the root folder in which I wish the folders that are to be created by this macro.


Standard property shoot folders.kmmacros (19.7 KB)

If you add tokens or variables to an action's text field, they will be processed (unless the action is expressly set to "Process nothing" via its gear icon). This means they will be 'translated' into the values they represent. %FinderInsertionLocation% is a token that represents the current Finder directory and %Variable%Local__Folder Name% is a variable that presents the value entered in the user prompt. These are separated by a /, so if the former is ~/Desktop and the latter is Joe Bloggs, we are now using the Create new folder action to generate the folder structure: ~/Desktop/Joe Bloggs.

There are a number of ways to achieve folder structure creation, but here's one using shell scripts:

Standard Property Shoot.kmmacros (23 KB)

Macro screenshot


I am changing things up a bit and the only place I think I need help with is just to start at the designated root folder but I am not sure how to tell KM that.

So when I press the Hot Key to start the macro, the first that that is done is to ask the name of the new folder it will create but it needs to know the root first. I am no longer using tokens as I am going to now just create 2 new folders on 2 different drives. This is just part of my housekeeping and workflow. Probably better to show in a video as this is going to get confusing.

Here is the link to the video

Folders for Photography and Video.kmmacros (25.1 KB)