Assign Logic Pro's Command-click tool with a keyboard shortcut
I keep Logic Pro’s left-click tool set to the Pointer tool. For the Command-click tool, I alternate mainly between the Marquee tool, the Rotate tool and the Slip tool. Logic provides the T
keyboard shortcut for changing the left-click tool, and you can set custom keyboard shortcuts to change to a specific tool — but only for the left-click tool. The only way to change the Command-click tool is to use the Command-click tool button.
Assigning the Command-click tool with UI scripting
User interface (UI) scripting lets you automate user interface events — clicking a button, for example — using AppleScript. I wrote a script that uses UI scripting to find the Command-click tool button, click it, and select a tool from the menu. Here’s the script (also available on GitHub):
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- Change "Marquee Tool" to any other tool.
set theTool to "Marquee Tool"
set theToolbar to missing value
set toolbarGroups to missing value
set commandClickToolButton to missing value
tell application "System Events"
tell its application process "Logic Pro"
set allGroups to every group of its front window
repeat with theGroup in allGroups
set subGroups to every group of theGroup
repeat with sGroup in subGroups
if role description of sGroup is equal to "toolbar" then
set theToolbar to sGroup
exit repeat
end if
end repeat
end repeat
if theToolbar is not missing value then
set toolbarGroups to every group of theToolbar
if toolbarGroups is not missing value then
repeat with tGroup in toolbarGroups
set theMenuButtons to menu buttons of tGroup
if length of theMenuButtons is greater than 0 then
repeat with theButton in theMenuButtons
if description of theButton starts with "Command-Click Tool" then
set commandClickToolButton to theButton
exit repeat
end if
end repeat
end if
if commandClickToolButton is not missing value then
exit repeat
end if
end repeat
end if
end if
if commandClickToolButton is not missing value then
click commandClickToolButton
set theMenu to menu 1 of commandClickToolButton
click menu item theTool of theMenu
end if
end tell
end tell
The script loops over the UI elements of Logic’s front window until it finds the Command-click tool button. This is the only reliable way to find the button because its position in the UI hierarchy isn’t consistent from project to project (or window to window if you have multiple projects open). However, the script runs so fast that it’s still more convenient than changing the tool manually.
The script changes the tool to the one specified by the variable theTool
. The following tools are available in Logic Pro 11.1:
- Pointer Tool
- Pencil Tool
- Eraser Tool
- Text Tool
- Scissors Tool
- Join Tool
- Solo Tool
- Mute Tool
- Zoom Tool
- Fade Tool
- Automation Select Tool
- Automation Curve Tool
- Marquee Tool
- Flex Tool
- Gain Tool
- Slip Tool
- Rotate Tool
Using the script with Keyboard Maestro
Keyboard Maestro is my go-to app for complex keyboard shortcuts. In this case, I created one macro for each of the three Command-click tools I commonly use. Each macro just contains an Execute AppleScript action with a different value for the theTool
. Here’s the macro for the Marquee tool.
Demonstration
The animation below shows the automation in action. The Command-click tool is initially set to the Marquee tool. Then it’s changed to the Rotate tool with ⌃⌥⇧⌘2, and then to the Slip tool with ⌃⌥⇧⌘3. Finally, ⌃⌥⇧⌘1 changes it back to the Marquee tool. (I have caps lock mapped to the “hyper key” — ⌃⌥⇧⌘ — with Karabiner-Elements.)
Notes
- I only tested this in Logic Pro 11.1 on macOS 15.1.1.
- If the Command-click tool button is hidden (because the Logic Pro window is too small, for example), the script won’t work because it won’t be able to find the button.