For new created tracks in Logic, very often I find myself having to set negative-delay values for the track. There are several common ones I keep on having to input based on certain sample libraries I use: -60ms, -100ms, -222ms, -333ms.
Any thoughts on a macro that can assign such a negative delay to a selected track when the macro is executed? Either one of the above as an example, or a quick way to prompt it in.
If it helps, I typically have the inspector CLOSED in the main tracks window on my main display, but I have it open on a second tracks window on a second display. However, the ‘Track’ option dropdown where the negative delay is typically set, I ‘usually’ have closed.
Super great start! Not fully working for me yet, but we can likely get it there.
When I run the macro, I get the excellent pop-up with the delay options. But for some reason after selecting one, I get the Logic error “Command not available because there is no plugin in that slot”.
Another important note is that I’m actually intending to set TRACK delay, not region delay.
Again, if it adds anything, my inspector pane is open on a second display, though the windows should all be visible for found image actions. Alternatively, wondering if they can be selected via apple script instead of found image / mouse moving if that would be cleaner?
Okay, let's try AppleScript. For testing, please simplify your screenset by closing any windows on your second display. Let's see if we can get it working in a single - Tracks window, first of all.
One thing to bear in mind is that it will fail if you have a movie imported, as it will change the inspector layout. Let me know if that's the case and I can add a contingency for that. Oh, and I haven't added in the mouse recall yet. If you want that now you can copy the first and last actions across from the first macro.
Thanks! Testing this one now in a single tracks window on my main display. I’ve popped open the inspector panel. When I run the macro, I successfully get the pop-up asking for delay options. However, when I select an option, the GROUPS window in the inspector is what opens up (“Track” is the drop-down right below). After the Groups window opens, nothing happens.
In my case, I was able tix this by changing the “Open Track Pane” script to the following:
clickUI element 1 of group 3 of list 1 of group 2 ofwindow tracks_window
… though the macro still ends after the window opens, perhaps now because the subsequent scripts need to be updated for the UI?
Ah… I suspect this will likely be the case as I often work with video files. Good catch.
If it doesn't work for you, first disable the Combined Script group and enable the Separate Scripts and test that. If it still doesn't work, send me the AppleScript output from the UI Browser Lite macro while hovering over the Delay field. That should hopefully show me any discrepancies between our screensets.
I'm hoping I've cracked it. Track: is always the penultimate group, so we can count the total number of groups in the inspector and use the second-to-last one. That way, regardless of whether the Movie or Group Inspector panes exist, we should still be able to target the Track group...
Next step is… any thoughts on how to get this to apply to my “Track” pane that’s open on my second display, instead of my primary (which usually has the inspector closed)? Is it as simple as just changing the UI elements in the script a bit?
If so, here’s what I get:
activate application "Logic Pro"
tell application "System Events"
tell process "Logic Pro"
click slider 1 of row 13 of table 1 of scroll area 1 of group 3 of list 1 of group 1 of window "Untitled 29 - Tracks"
end tell
end tell
Looks like the last Group 2 changes to Group 1.
… Reading your Apple Script, though, I suspect it might be a bit more complicated! Or maybe just a matter of targeting the SECOND window whose title contains “ - Tracks”?
My primary window is really just the tracks area and what I am mostly in for sequencing purposes. Second main window is for all my parameters – I’ve got the library open, inspector pane open, and mix window open there.
All that said, I did test the macro with my setup and, so long as indeed the second window is at least selected, it works perfectly. I usually am creating new tracks via the second window (hence the open library) so I figure it’ll get selected that way already, so we might be good to go. If not (and this is pending me doing some real testing with it) I guess it may just need an action to quickly select that second window (which i imagine is fairly easy, either a quick click-action or something similar)
We need to determine the index of the front app's window which:
contains the string '- Tracks' and
is on the screen whose index is 4.
I know we could loop through windows until the conditions are both satisfied, but we don't want to switch to it; that would be too easy! We want to determine it for use in an AppleScript.
Okay we've hit on something I haven't done before in KM: iterating through two synced lists via a line count... My brain has been nudged, but it's now rolled over and gone back to sleep!
This, from the outline above, would be my preferred method because while it is more complicated it only makes three API calls -- one to get the screen bounds, one to get all the window names, one to get all the window positions.
The simpler method is to target each window in turn:
For Each: Local_i from 1 to WINDOWCOUNT()
If %WindowName%Local_i% contains "- Title" AND WINDOW(Local_i, Left) >= SCREEN(4, Left) AND WINDOW(Local_i, Right) <= SCREEN(4, Right) AND...
...which involves many more API calls (obvs the SCREEN(4, ... ones could be done before the "For Each" and stored in variables, but that's still 4 API calls rather than 1).
Anyone playing along at home might like to give the "simpler" method a go, using the same logic for name and screen matching as the posted demo does.