If new .wav file is saved within specific folders, open its folder

Within the folders contained in ~/Files, there are three specific folders I use for podcast editing.

I've been trying to get KM to do the following: whenever I export a new .wav file in any of these folders, I'd like KM to open the folder where the file was saved.

I've tried many solutions for similar problems, but had no luck making it work. This seems pretty simple, but still I can't figure it out.

Thanks!

1 Like

Try this:

Use the specific path for one of your folders. Then add two more triggers, one for each of your other two paths.

Thanks for the reply! I had run into this solution, and it would be perfect if I always exported .wav files to the same folders. But I use the following structure:

-Files
-----Unrelated Folder
-----Podcast 1
----------Episode X
----------Episode Y
----------Episode Z
-----Podcast 2
----------Episode X
----------Episode Y
----------Episode Z
-----Podcast 3
----------Episode X
----------Episode Y
----------Episode Z
-----Unrelated Folder
-----Unrelated Folder
-----Unrelated Folder

Each new episode has its own folder, so I need the macro to work in a bit more general/dynamic way.

My goal is: whenever a new/overwriting .wav file is saved within any subfolder within Files, I'd like KM to open/bring to front this specific subfolder. Part of me is starting to think this might not be possible.

You can't do it via a watched folder, because the watched folder trigger has this requirement: "The item must be directly in the folder - changes in a subfolder will not be noticed."

I'd probably try to tackle it from the other end: Where do you save .wav files from? Set a macro to run in that app when you want to save a WAV file. Have the macro do the work to save the WAV, and then it can easily track and open the changed folder.

-rob.

1 Like

Aha! At first you said "three specific folders" (as quoted above) and now you are saying an unlimited number of folders inside those three specific folders. Rob's idea may work for you.

1 Like

For watching Folders the App to use is Hazel. It works well in conjunction with Keyboard Maestro and many users on this Forum use both Hazel and Keyboard Maestro. Although Keyboard Maestro has a Folder trigger, once you start to get to tasks like the one you are trying to solve, I think it's better to use Hazel to watch the folders (watching folders is the whole purpose of Hazel). The neat thing is that Hazel can trigger Keyboard Maestro Macros.

In your case you could do the whole task in Hazel (monitoring the folder/subfolders and revealing the new .wav file in Finder). To monitor the sub folders as well as the main folder you do this -

https://www.noodlesoft.com/manual/hazel/advanced-topics/processing-subfolders/

But if you wanted to use Hazel to trigger a Keyboard Maestro Macro, you could do that too via an AppleScript snippet.

In your Keyboard Maestro triggers you will see an option "Or by script."

Click on the up/down arrows and choose AppleScript

This will give you a snippet of AppleScript pre-selected. You press ⌘C to copy this to the Clipboard.

In your Hazel Rule, you choose "Run AppleScript" and use "embedded script" - you paste in the text you just copied from Keyboard Maestro.

This is what this looks like in Hazel -

And that's about it. Hazel would take care of the triggering and Keyboard Maestro would do whatever heavy lifting your Macro does.

6 Likes