Hi all. Having some trouble getting into the syntax of KM and would love some help thinking about how to approach this problem. If someone could point me towards some good tutorials for this topic, I'd appreciate it- I don't need code written, just something to read up on to start learning and working!
I would like to write a macro to condense a folder full of sequential files into folders. They are stills from a video that export with the frame number appended to the file name. So think...
in one folder. I would like to create three folders (videoA, videoB, and videoC) and move all files with the common name (save for the last x characters) into that folder.
I think I understand how to call up a folder in the macro sequence and how to write a file name to a variable, but I guess my questions are:
How do I read the filename variable so that a file is moved to a given folder if the first x characters are the same?
How do I sequentially read through the entire folder and break the sequence upon completion?
Broadly, what is the syntax for retrieving a folder or file in one action and then use that as a condition, argument, or variable in another action?
I hope that that makes sense! Very new to this and would love to get my feet under me a bit, but finding it hard to know how and where to start tinkering
Once you learn a bit about KM, you will find tasks like this one fairly easy. But, like with all languages, you have to first learn the terms and definitions and syntax of KM. I think you'll find KM easier to learn than most. It is designed for non-programmers, but if you happen to be a programmer, that is to your advantage -- mostly from understanding how to construct the logic of any program, a KM Macro in this case.
So, let me give you some rough pseudo code, to help get you started.
this is not perfect, and I may have left out some small statements (KM Actions).
Use a formula or a Switch or Case action to set a Variable "DestinationFolder" to the destination path for this file
For example, if the paths to all of your destination folders look like this: ~/Documents/Some Folder/<fileRoot>
THEN a simple Set Variable to Text action will work fine. Something like this:
Set Variable "DestinationFolder to ~/Documents/Some Folder/%Variable%fileRoot%
Nickrs, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.