Dynamic Dropdown Options Based on Number of Folders in a Directory

Hello! So glad to start using keyboard maestro for automating my tasks.

I've gotten a little ahead of myself I think and want to create a screen capture organization macro that achieves the following when a screenshot gets saved to a directory:

  1. Trigger the following actions when the screen capture gets saved into a directory. Pretty simple so far haha.

  2. Once triggered the first action is to prompt the user with a dropdown list of folders that are inside a given directory. In my case, each folder correlates with a project I'm working on. So the drop-down options, for example, would be: My Project Folder One, My Project Folder Two, My Project Folder Three etc.

  3. After you select from the list of folders you want to save your screen capture it takes the screenshot a moves it to a Media folder inside the folder that was selected in the dropdown. That is it!

The problem is I don't want to keep adding If/Switch conditions to the macro every time I want to add a new project folder in my projects directory as well as a value for the dropdown list.

So my question is... How do I dynamically update the dropdown list when I create a new folder in a given directory and update the logic to then check if the user selects a destination folder to move the screen capture too?

Attached is the hardcoded way that works but isn't dynamic. I know I could just do something with a script but I'm trying to learn the visual editor! So if it's possible to do this without scripting that would be awesome!

Thanks, J

Screen Capture Organization.kmmacros (6.4 KB)

Hi @atx-barnes,

While scripting would probably be faster, it's certainly possible to do something like this without it. Here's a version of your macro that populates the folder dropdown list automatically and saves the trigger file to whatever you select, without hardcoded if/else actions:

Screen Capture Organization (Auto-Propogated Folder List).kmmacros (5.0 KB)

1 Like

@gglick Thank you! This is perfect.

1 Like