First Time Programming Help;-)

Hey Everyone,

I'm writing my first program in keyboard maestro and it is definitely a little over my head. I'm trying to name a series of audio clips that have been cut and separated using various keystrokes(another macro that I have working). I've been learning about the different programing loops and have compiled a pretty good understanding but I'm stuck with repeating the series of actions while updating the names in a particular sequence determined by User Prompted variables. This is my main Problem.

I have an audio file that is distinguished by different sets and amounts of clips within each Set. I have default values for 3 sets of 4 audio clips. Sets are distinguished by being soft, medium and loud. Sometimes the default number of 3 sets can change to something different like 2 sets (Soft and Loud) or 1 set (Loud). Same with the number of audio clips i.e. the default of 4 clips can change to a new amount of 5 clips. These audio clips are initially 1 audio file on a time line in Pro Tools like this

The above example has 3 Sets of 4 clips each.

The above example has 3 sets of 2 clips each

I would love to prompt myself to enter the Number of Clips, The Number of Sets, The Names of each Set and the Sequence of the Sets. The number of sets are almost always 3 but can change. The order of sets are almost always Soft to Medium to Loud but sometimes they can change too becoming just Loud and Soft. (I have no idea how to set up the Names of each Set or the Sequence to match the audio file on the timeline) Problem #1 Thoughts? Is it possible to create a matrix of sorts within the Prompt User for this?

I understand obtaining these values by prompting myself to input them.

The above values would render 3 sets (Soft, Medium, Loud)
and 4 Clips(1,2,3,4) this beging the typical audio file.

The loop function to name each clip then update the name of the next clip in succession is what I'm failing to comprehend. Problem #2

If I'm not clear here is an example below.

Using the time line below, I have the 3 sets of 4 clips.

The 1st set would be soft1, soft2, soft3, soft4
The 2nd set would be medium1, medium2, medium3, medium4
the 3rd set would be loud1, loud2, loud3, loud4
and would appear as this below

soft1--soft2--soft3--soft4--medium1--medium2--medium 3--medium4--loud1--loud2--loud3--loud4

My goal is to get the macro triggered which would result in naming each of the clips in succession(Left to Right) using the prompted values like in the picture below.
soft1--soft2--soft3--soft4--medium1--medium2--medium 3--medium4--loud1--loud2--loud3--loud4

I can successfully maneuver from the start of the clip to the end editing each individual clips but again can't figure out how to add some kind of insert text action to change each clips number and set description. Problem #2. I had a repeat within a repeat which would edit how many clips then repeat for however many sets while moving in sequence from left to right.

I believe that I need to use the "Repeat Control Flow" to find a new kind of repeat loop to successfully select each audio clip and properly name them.

My understanding of the type of loop needed is as follows

Repeat
Keystokes for Selecting Clip
Name the Clip
Update Counter1
Do this until the Counter1 = the number of Clips

Update Set Description to the next Set Description

Repeat
Keystokes for Selecting Clip
Name the Clip
Update Counter1
Do this until the Counter1 = the number of Clips

Update Set Description to the next Set Description

Repeat
Keystokes for Selecting Clip
Name the Clip
Update Counter1
Do this until the Counter1 = the number of Clips

Do this until counter2 = Set Description

Am I on the right track??? After 4 days I'm not going to give up but I know this is pretty complicated for a beginner.
I appreciate any thoughts and feedback. If anyone is near LA i'll totally take you out for a beer too! Thanks again!

This is an ambitious macro for a beginner! I'm impressed; I definitely wasn't making anything this complicated when I was starting out with KM :slightly_smiling_face:
I believe you are on the right track, so let me see if I can help fill in the pieces you're missing. To answer your second question first:

This kind of repeat loop is called "Until" in KM, and an example of the kind you describe would look something like this:

However, I'm not sure you need to use this kind of loop, as from what I can tell, you're already on the right track using a repeat loop inside a repeat loop, and just need to know how to name each clip in sequence for each set. So here's how to do that:


If I understand your workflow correctly, this set of actions should automatically rename each clip in a set by combining the "Volume" variable (selected with a dropdown menu here; feel free to erase the current default values if you'd rather enter this manually) and the "Clip Number" counter for each clip until each clip in a set has been named (of course, you will need to replace the placeholders with your actions for selecting each set and clip). Here's the sample macro I created to help you get started:

Sample: Rename Sets of Clips.kmmacros (5.0 KB)

Let us know how this works, and if you run into any issues. Also, for future reference, can you share your macro and/or the audio editor you're working with? Doing so can help us better assist you, as the more information we have to work with, the better (for example, depending on what audio editor you're using, there may be a more precise way to select each set or clip then with simulated keystrokes and mouse clicks).

2 Likes

Hey Gabe,

Thank you for taking the time to walk me through this. I will definitely share my finished macro and
information for everyone else! I believe you filled in the gaps. I’m going to go through you post super carefully and learn. I’ll post after this to let you know!

2 Likes

Hey Gabe,

This worked perfectly. I’ll upload my macro with a detailed explanation to the Pro Tools Section!
Thank you for the assistance!

1 Like