Logic Pro - Macro Megathread (2022)

Yes as you said it keeps changing the value of UI elements and it's so annoying.
Open/close the region/track inspectors, which is using quite a lot, UI element value varies on if you have groups and movie tracks activated.
So I tried scripted codes below (referenced the macros you've shared) to manipulate inspectors whether you have movie/groups enabled or not
(Didn't considered movie track in that time, should revise)

activate application "Logic Pro X"
tell application "System Events"
    tell process "Logic Pro"
    
        set tracks_window to title of first window whose title contains "- Tracks"
        
        --open region
        if value of static text 2 of group 1 of list 1 of group 2 of window tracks_window is "Region:" and value of UI element 1 of group 1 of list 1 of group 2 of window tracks_window is 0 
then
        click UI element 1 of group 1 of list 1 of group 2 of window tracks_window
        end if

    
        --oepn more
        if value of UI element 1 of group 1 of row 9 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window is 0 then
        click UI element 1 of group 1 of row 9 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window
        end if

        --open track
        if value of static text 1 of group 2 of list 1 of group 2 of window tracks_window is "Track:" and value of UI element 1 of group 2 of list 1 of group 2 of window tracks_window is 0 
then
        click UI element 1 of group 2 of list 1 of group 2 of window tracks_window
            --if you have groups activated
        else if value of static text 1 of group 3 of list 1 of group 2 of window tracks_window is "Track:" and value of UI element 1 of group 3 of list 1 of group 2 of window tracks_window 
is 0 then
        click UI element 1 of group 3 of list 1 of group 2 of window tracks_window

        end if

    end tell
end tell

It's good to challenging and learn lots of things but it took long time to script in this way,
Is this kinda approach the best method alternate the 'find image and click' actions?
What's your thoughts on them?

add: Is there no way to use UI Browser that you mentioned before? After the developer retired and my trial finished, cannot access the official site nor purchase is unable.

add2: Thanks to the generosity of father of UI Browser, Late Night Software released opensource version of UI Browser.

They're always the last resort. I prefer relative coordinate clicks, hotkeys, menu items, scripts... I'll only use found images if there's no alternative or if the macro needs to be extra quick. For example, when I hit record, it turns on Low Latency mode for me. I use found images of the toolbar button as it's much snappier than scripting.

1 Like

If your talking about the settings button in the plugins column then its,
click (every button whose value of attribute "AXDescription" is "Setting") of UI element 1 of UI element 1 of group 3 of list 1 of group 2 of window 1

1 Like

Logic - Scan Plugins

This macro lets you select plugins on the Stream Deck and then opens the plugin in Logic on the send/bus or normal as well as show the icon on the Stream Deck. The Scan macro shows the channel strip plugins on the Stream Deck.

On the Stream Deck you can toggle or bypass the plugins by selecting the mode and pressing the plugin icons. Long press on a plugin icon will open the plugin Stream Deck profile for custom actions for that plugin.
you can see some of the actions from this YouTube video, https://youtu.be/lIwXno6yWeQ

the macro size is to big to upload so here is a link, https://incolide.com/?smd_process_download=1&download_id=2594

For the macros to work fully with the Stream Deck, you can get the Stream Deck profiles which have all the button ids programmed, and the app files here.
https://incolide.com/producer-corner/

(Note: It does require the keyboard Maestro Stream Deck plugin to be installed.)

1 Like

That's awesome! I don't think I'll switch to it, as AS is so much slower than found images (unfortunately). For anyone else wanting to try it, here's a full working script:

activate application "Logic Pro X"
tell application "System Events"
	tell process "Logic Pro"
		
		set tracks_window to title of first window whose title contains "- Tracks"
		
		click (every button whose value of attribute "AXDescription" is "Setting") of UI element 1 of UI element 1 of group 3 of list 1 of group 2 of window 1
		
	end tell
end tell

Very interested to dig into this and see your process! Again, won't be applicable to me personally, as I use PlugSearch. Thankyou for sharing!

1 Like

Hope you find a few things helpful for your workflow, I will say the scripts are actually faster than found images, but only when you use the timeout and try feature together, for example

try
	with timeout of 0.3 seconds
		tell application "Logic Pro X"
			tell application "System Events"
				tell process "Logic Pro X"
					set tracks_window to title of first window whose title contains "- Tracks"
					click (every button whose value of attribute "AXDescription" is "audio plug-in") of UI element 1 of UI element 1 of group 3 of list 1 of group 2 of window 1
					
				end tell
			end tell
		end tell
	end timeout
end try
1 Like

Wow! 0.53s instead of 1.84s! This is going to change my use of AppleScript dramatically! No idea why it's faster, but the main reason I tend to avoid AS with Logic is because of the lag.

For some reason both these scripts fail as soon as you add a plugin to the channel strip. Maybe we're on different versions of Logic? I'm on 10.7.5.

I've got a similar system going myself: Triggering Stream Deck Profiles for Logic Pro Plugins

You've put a lot of work into that collection of macros. Fantastic!

The very short of it with the script time is, the callback/run time is about 1.5 seconds, and with the timeout command it cancels the callback.
I'm on os Monterey, Logic 10.7.5 and it runs perfectly.
Did you run the script in the script editor or keyboard maestro?

I'm not sure I understand this, but it certainly does seem to work.

KM

Without seeing what its doing I'm not sure why it would be throwing an error. Most of the time the errors I have seen occur with scripts is when there isn't enough cpu power as scripts are heavy and need more time to finish the task. So then changing the timeout from .3 to .6 or .8 might help. For example we ran multiple scripts in a row thru KM on a intel macbook, and had to set the timeout to .8 for each script but on a m1 pro macbook the timeout could go as low as .1

1 Like

I tried it without the timeout at all and it still fails.

can you post the failed run?
I might be able to figure it out.

What do you mean by "post the failed run"?

Screenshot of the error/fail

Oh wow another massive macros!
Glad you joined the forum and thanks for sharing.
But I'm afraid there is same issue running script as @noisneil had.

Since there's no error message pops up, it seems not an error.
And think it's not cause of CPU power I'm running M1 MBP.

M1pro MBP 2021 / OS 12.6.1 / Logic Pro 10.7.5 / tried run script both KM and Script Editor

Same here. Nothing happens at all.

Additionally, are your macros cannot be triggered by KM itself?
Since I use "KM Link" plugin instead of "Keyboard Maestro" plugin what you've used (installed but barely run), run it via KM directly, but it failed.
Error message screenshot is below. I run macro named 'Inst - Logic ES1'
But anyway, I gotta apply your macro works in my own. It would be very helpful improve my workflow.
Thanks again.
image

And btw, how can I get entire error message not using notification center? MacOS Notification Center only shows first few lines and it happens nothing when I press show button bottom of the box.

add: I just found the triangle at the top right corner expands the message. but only one message at a time can be expanded.:rofl:(like X-OR method)
These are the messages. (still the second one is not show the entire message)
image
image

Ok On the Action fail its looking for the Applications that go with the Stream Deck profiles. There is additional python scripts and icons outside of KM to trigger profile changes when a plugin is opened which is not included with these uploaded macros as they are in the paid bundle. You can disable that action by going in the KM group, Logic - Actions / Scripts Scan Plugins, and disable macro, Once Plugin Opens Switch Stream Deck Profile.

The macros for the individual plugins can be triggered by KM Link but make sure the press and release is the same trigger, but generally yeah everything is run by the KM plugin.

Hey @noisneil

I'm trying to set this marker list menus
(Show Event Position and Length as Time, Length as Absolute Position)
both checked with Applescript like this:

tell application "System Events"
   tell process "Logic Pro"
      
      set marker_window to title of first window whose title contains "- Marker List"
      
      click menu button 1 of group 1 of group 1 of window marker_window
      click menu item "Select All" of menu 1 of group 1 of group 1 of window marker_window
      
      click menu button 3 of group 1 of group 1 of window marker_window
      if value of menu item 1 of menu 1 of group 1 of group 1 of window marker_window is 0 then
         click menu item 1 of menu 1 of group 1 of group 1 of window marker_window
      end if
      
   end tell
end tell

But cannot force set value to checked. (Also tried "Set value to...")

Any solution on this?

It's so tricky to automate Logic. (even though it is Apple's own software!)

Thanks!