If - else based on applications menu item being present or not

I'm trying to rename regions within my DAW (Pro Tools). When I have setup the macro to rename all regions, it works just fine. But sometimes one of these regions is not present and the renaming process for that region should not start, instead, it should advance to the next track.

This works for me when I use if-else as shown in the image above. But only once. After that it just does the 'else' part.

Anyone have any suggestion how to make this work for all regions?

Hey Joey,

Since we can't see the rename action, we have no way of guessing why it failed...


1 Like

Hi Chris, Sorry, have to be more clear.

The 'Rename Clip Shortcut Menu PT' is a menu item only present when a clip is selected. Based on this I wanted to create an if-else statement.

If the menu item is present this means a clip to be renamed is selected so the action 'full mix rename' can start.
If the menu item is NOT present it should select the next track.

The screenshot you see here is 5 times this. Except for the start track, since that is always present.

Now when the 1st track and 3rd track being present, the script works as expected. it tries to perform a rename on track 2, which is not present, so it skips to the next track and performs another rename.

BUT: when 2 tracks are not present, it works on the 1st track not being present, but then for the 2nd track not being present it execute the 'otherwise'. KM just doesn't get the 2nd failed action.

So the If statement with action result being failed doesn't work as supposed.

To find errors I have put in some alerts in both executors to see which route the script goes.

Long story short: if a clip is present it should perform a rename action. If the clip is not present KM should read the failure in some way and skip to the next track.

I found my error! I put a pause after the action to be checked, and that will always be 'OK' so KM did not get the 'failed' I needed for this macro to work.

If anyone has a better approach to what I'm trying to achieve here, let me know!

1 Like