KM controlling Final Cut (FCP)'s of inspector panel

Does anyone have any experience/tips in getting KM to be able to control Final Cut Pro's inspector panel?

For those who aren't aware, anything you click on in various panes of FCP shows its properties in the inspector panel. These can vary from sliders to knobs to drop zones to pulldown menu choices.

I spend a LOT of time tweaking things repetitively in FCP's inspector panel and I'm just wondering if anyone has any bright ideas for controlling things.

For example, click on video clip 1, go to inspector panel, and adjust one specific property by +x. Then click on video clip 2, and do the same. x100.

I know it can probably be done via Found Image but I'm hoping for something more bulletproof, because the way FCP draws its UI can vary. If I knew how to crack open the FCP file and edit the raw values in an XML file I would!

1 Like

I use Keyboard Maestro to automate a lot in Final Cut Pro. My approach is to first try and find what Keyboard Shortcuts work and then string them together. I also use Keyboard Maestro to change the default shortcuts to ones I think are more logical - or I just find easier to remember.

Once in the Inspector Panel, the Tab key will move from field to field. So, if you need to enter multiple values that can be used in a Macro to partly automate the process - e.g. if you had to enter a value in each of the transform fields.

One thing I find that helps a lot is to save your current layout as a Workspace in Final Cut Pro and then call up that workplace as the first item in the Macro - that way the UI elements will be in a constistant place and position.

I have used the above approach to simply move the mouse cursor to a pre-defined position on screen and click (that way avoiding using Found Image). By calling up the saved Workspace the elements will be exactly where they need to be and I've found this is very reliable. I even use an If, Then, Else Action to move to a different part of the screen depending on which Mac I am working on.

So, the basics of such a Macro would be:

  1. Make Final Cut Pro fill the screen and call up the Workspace.
  2. Depending on which Mac I am working on, move the mouse cursor to a specific point and click.
  3. And/Or Use Tab keys in the Macro if I need to move to a different field.

Any such Macro would be very specific to whatever you are trying to achieve but here is an example to better explain what I mean. This Macro doesn't do anything as such and uses the names of my Macs. It is just here as an example of how to approach making your own Macro. Hope this helps!
Example Final Cut Pro Inspector Macro.kmmacros (44.1 KB)

NOTE: I answer your question specifically at the end of this post, so don't miss it, but you should read this entire post, because trust me, I know what I'm talking about (but I'm always willing to hear other ideas - in fact, I'd be THRILLED to hear other ideas!).

I have been automating a TON of things in FCPX for many years now, including using JXA to get to the UI elements on screen (not for the faint of heart). I only mention it so that when you post another FCPX question, you might want to tag me because I don't check in very often but I do respond to the email notifications.

I like everything @Zabobon said in his post. I have found using "Find Image" to work just fine with the Inspector - things haven't changed much in a while. With that said, I use Workspaces all the time, and I like @Zabobon's idea of assuming screen coordinates will work. I would put the screen coordinates into a sub-macro - see the following:

Here's my most important advice:

Put everything you can in sub-macros, so if something changes in the UI, you only need to change it in one place.

For example, here's a partial list of my UI sub-macros, in a group named "FCPX UI":

image


Of particular note are macros like [FCPX UI] Timeline.GoToBeginning and [FCPX UI] Timeline.Focus. Yes, all they do is type a keyboard shortcut. But if I ever need to change that shortcut, I only change it in one place.

I use my macro Copy Macro as Execute Macro to copy a reference to one of those macros, and paste it into a macro so it looks something like this:

image

Or you could just use my KMFAM macro to make it even easier to insert.

So, to answer your question:

I do what you're talking about all the time, and I usually do it with a sub-macro that returns the screen coordinates of the UI element(s) I want to change. Then all I have to do is "click" at those coordinates, and go from there.

For example, I have this macro:

This returns the x/y screen coordinates of the Inspector fields Pos X, Pos Y, Rotation, and Scale. Then I can use them like this example:

In closing:

I hope this helps. Feel free to ask questions, or ask for the macro sources, whatever.

However, I won't share a lot of my UI sub-macros without a discussion first, because I'm not going to be responsible for maintaining them when something changes. For some of them, maintaining them is a no-brainer. But the ones that use JXA to hit UI elements are extremely fragile (meaning UI changes can break them). Don't get me wrong - I'll be maintaining them for myself, but if your workflow becomes dependent on them and you can't change them yourself (because of JXA or whatever), don't expect me to jump in and fix them right away. :grinning_face_with_smiling_eyes:

Dan

1 Like

Wow. These are fantastic tips. Thank you both for the detail. It will take me some time to delve into them.

In the course of solving my urgent/immediate problem, I came up with a couple more discoveries/tips so I'll log them here in case they're useful for others. Note that my macros are jerry-rigged immediate solutions to specific problems, as opposed to well-designed future-proof macros that anticipate every possible FCP configuration.

In my case, I need to do repetitive actions that involve activating one clip in the Timeline, going to the Inspector, filling in specific values, then repeating the macro for subsequent clips. (Yes, I'm aware of Paste Attributes, but in my case, that doesn't work.)

First, FCP is not always the snappiest program, so I have to Set Simulate Normal Keystroke Delay For This Macro to slow down the typing. FCP works OK at 0.1 when the timeline is light but I had to up this value to as high as 0.3 to avoid errors when the timeline was very complex and had hundreds of clips in it.

Next, I discovered that there is a FCP shortcut for activating the Inspector (opt-cmd-4). This shortcut has the VERY nice added feature of already highlighting the first field for text input, so it's basically ready for me to custom-program the values I want inserted by KM.

Then I use "Insert Text By Typing" and insert the string of values I want to insert. I insert tabs anytime I need to skip to the next field, and double/triple/etc. tabs anytime I need to leave fields intact the way they are.

Then I use the cmd-2 keystroke to re-activate the Timeline.

Then I use cmd-down-arrow to activate the next clip downwards. (In my case, I have dozens of connected clips on top of each other because I"m making a virtual choir video.)

Then I can loop the macro.

This works very well. It's probably not super bulletproof but at least it got me through dozens of customizations and did it well.

I'd happily make a YouTube tutorial of what I did, but I don't know how big the audience is for geeky FCP+KM power users...

Comment to @DanThomas: I admire your thoroughness. Your example of retrieving the x/y coordinates of specific parameters is useful, but I assume it might break if there are too many plug-ins visible in the Inspector which would cause the Transform controls to be offscreen.

This entire time, I've been wishing that FCP gave us access to the actual XML data, or had some other method for manually entering parameters. Paste Attributes is the closest FCP gives us to that, but in my case, that wouldn't have worked, because I needed the parameters to vary on a per-clip basis.

There are many other parallel things in FCP that I wish were automate-able, especially drop zones and selecting the first frame of a clip to put into a drop zone.

I have never encountered a situation where those controls are offscreen, but then again, I have a large monitor. But I have to say, if you worry about outlier situations, you'll never automate anything. It's not as though your computer is running unattended - you're right there to deal with problems.

So if I ever encountered that situation, the "Find Image" would fail. At that point I'd decide how to handle it. It could be as simple as manually collapsing one or more of the plugin's boxes in the inspector, then run the macro again. And since those boxes remain collapsed from clip to clip, no big deal. If it was a fairly common situation, I might try and find another solution.

And truth be told, I could solve this through UI manipulation using JXA, so I could have the macro scroll the controls into view. Fortunately I haven't had to resort to that, but it's something that could be done.

My point is, if a problem comes up, solve it. I mean, yeah, if the chances of it failing are high, then another solution needs to be found. But the more you start automating things, the more you get good at coming up with solutions.

You can always post here and ask for other ideas.

And yes, of course we all wish they'd use XML or JSON to make it easy to edit things that way. And we've been asking them for years to add Scripting support (OSA) to Final Cut, and it just falls on deaf ears. So I'm not holding my breath.

So it's up to you how to respond. Personally, I like automating things, even when there are challenges.

1 Like