Hi there. I’m trying to set up a macro that is a “start of the day, launch all my applications, a couple of current documents and open a new project from a template file” thing. I work off of a specific template file in Digital Performer for a few weeks at a time, then move onto a different one. A new template file gets created for each project, and they’re in different folders, so it’s not pulling from exactly the same location each time.
It seems to me that a way to go about it would be to have my current project template tagged with a “CurrentTemplate” tag, one that gets added when I start a project and removed at the end so there’s only one file tagged like that on my drive. Is there a way to have KM search for a specific tag and open that file? It seems like something possible, but I haven’t figured out how to do it yet.
Are they all in the same folder? If so, you can easily search a folder using the Folder Contents collection.
If not, you would have to search your whole disk, which I think can be done using the mdfind unix tool, something like:
mdfind 'kMDItemUserTags == CurrentTemplate'
Otherwise, you could potentially just select the new template file, and run a Keyboard Maestro macro that saved the Finder selection path in a variable, and use that variable in your script. Your script could deal with the variable being empty (if it had been erroneously deleted for example) by prompting you for the file.
Hi Peter, thanks for getting back to me. I have them on the same drive, and as part of my “Current Projects” folder, but each project has it’s own hierarchical folder system, so the template for each project is in its own folder. Sort of like this:
I think the best option might just be the third one you mentioned, saving the Finder Selection path as a variable and recalling it from a macro. That way it accounts for them being in separate folders, but doesn’t do a search on the whole system. Does that sound right?
Hey JMichaelTX, I’ve had a chance to give it a shot, and it looks like that’ll do the trick. I’ve replaced the last Display Text action and with an action to Open %Variable%Local__FileList%, so far it seems to be working.