I’ve been doing quite a bit of macro maintenance in my Keyboard Maestro collection. That also means I’ve been writing new macros because once that KM window is open I tend to fall down a lot of rabbit holes.
Every January I need to create a sequence of numerical month folders on a couple of servers. It’s easy but repetitive work. This is a good niche for Keyboard Maestro. This macro accepts a starting number and ending number and creates zero padded folders like 01, 02, 03.
Here’s the macro:
The most interesting bits in this macro are the decimal formatting at the start of the “While” loop and the “until” calculation at the end of the “While” loop.
KM has a several functions for formatting strings but the simple “%Dec2%
The “while” loop continues until I’ve created the right amount of folders.
Another thing I find myself needing more often than you might expect, is the path of the current Finder folder. This is not hard but I like the KM way. Here’s the macro:
It’s neat because Keyboard Maestro has a built in variable that is just the current Finder view which is just the path of the view. I go two more steps than I need to if I just wanted to copy the path. I also display the path in an alert just for sanity. No need to check the clipboard.
Here’s one that’s particularly fun even if it lacks good error handling. Ever take a screenshot to the clipboard and then decide you’d rather have it as a file in a folder? This macro checks the clipboard for an image and if it exists then it saves it as a file in my “ScreenShots” folder as a jpeg.
To do it right, I should probably make sure it’s really a jpeg and yada, yada, yada. I trigger this manually and the worst that would happen is that I try to save something that can not be saved as a jpeg. I’ll fix it up next year when I clean out my macros.