A technical support community for Apple Logic Pro users.

 
speakerfood
Topic Author
Posts: 111
Joined: Sun Mar 21, 2010 2:48 pm
Location: Netherlands
Contact:

Change Region Gain With Key Commands

Thu Dec 22, 2016 5:55 am

With a little reverse engineering I managed to create an AppleScript that changes the gain/velocity of a selected region.
You can call this script with an application like yKey, and have it mapped to any shortcut you like.
http://plumamazing.com/mac/ykey/

Note: this only works if you have the Control Bar visible at the top, and the Region inspector is open.

Applescript to change the gain +3dB or the velocity of a MIDI region by 30:

tell  application "System Events"
tell  process "Logic Pro X"
tell  row 6 of  outline 1 of  scroll area 1 of  group 1 of  list 1 of  group 2 of (first  window  whose  name contains "- Tracks")
set  x to (get  value of  slider 1)
set  value of  slider 1 to  (x + 30)
end  tell
end  tell
end  tell

Applescript to change the gain -3dB or the velocity of a MIDI region by -30:

tell  application "System Events"
tell  process "Logic Pro X"
tell  row 6 of  outline 1 of  scroll area 1 of  group 1 of  list 1 of  group 2 of  (first  window  whose  name contains  "- Tracks")
set  x to  (get  value of  slider 1)
set  value of  slider 1 to  (x + 30)
end  tell
end  tell
end  tell
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Change Region Gain With Key Commands

Wed Feb 14, 2018 5:47 pm

speakerfood wrote:
With a little reverse engineering I managed to create an AppleScript that changes the gain/velocity of a selected region.

I just tried this, and it seems to change the Fine Tune in the Inspector instead of the Gain parameter.. any help? I do have both the Control Bar and Region Inspector visible by the way. Would be great if I get this working!
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
Eric Cardenas
Moderator
Posts: 22735
Joined: Sat May 07, 2005 1:47 pm
Location: Uppsala, Sweden

Re: Change Region Gain With Key Commands

Thu Feb 15, 2018 12:16 am

Try this instead:

tell application "System Events"
   tell process "Logic Pro X"
      tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of (first window whose name contains "- Tracks")
         set x to (get value of slider 1)
         set value of slider 1 to (x + 30)
      end tell
   end tell
end tell
Eric Bradley Cardenas
EC Making Sound
Mac mini 2.6 GHz 16GB RAM Areca⚡RAID | MacBook Pro 2.3 GHz 16GB RAM | Os 10.14.5
Logic Pro 10.4.5 | RME Fireface UFX | Adam A7 + Sub8 | Spectrasonics | Softube
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Change Region Gain With Key Commands

Thu Feb 15, 2018 3:12 am

Eric Cardenas wrote:
Try this instead:

Thanks so much Eric!

Also, for anyone interested I'm using the Better Touch Tool app to run this script via custom key commands. It is 3 times (suggested Pay-What-You-Want price) cheaper than the Y Key app that was suggested in the initial post, and you can remap your Trackpad and regular key commands to do whatever you want. Better Touch Tool has about 80% of the features that Y Key has as well.
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Fri Jul 13, 2018 11:19 am

I have the macro working but it seems to conflict with Logic Key commands? Every time I hit the keys I assigned Logic just flashes gray (like it does when you hit a key that isn't assigned anything). This could be such a great workaround if I can figure this out!
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Change Region Gain With Key Commands

Fri Jul 13, 2018 6:42 pm

morganmd7 wrote:
I have the macro working but it seems to conflict with Logic Key commands? Every time I hit the keys I assigned Logic just flashes gray (like it does when you hit a key that isn't assigned anything).


It's most definitely conflicting with a Logic key command if it's flashing like that, you should probably check out the Logic's Key Commands window. One good way to test out whether the key commands you've set conflict with Logic's or not is by assigning them to an un-assigned Logic function first just as a test. If there are conflicts you will immediately be alerted with a pop up message.

The other thing you need to keep in mind is that the Inspector on the left must be visible for this to work, it doesn't work with the Region Inspector float window.
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
facej
Posts: 537
Joined: Sun Jul 28, 2013 7:00 pm

Re: Change Region Gain With Key Commands

Sat Jul 14, 2018 2:53 pm

Thanks for the scripts! I use a tiny application called "FastScripts" which is all about script execution.
I saved 2 scripts - one for +3 dB, one for -3 dB, assigned keypress SHIFT-OPTION-F11 and SHIFT-OPTON-F12 - that's where the speaker up/down icons are on the Apple keyboards - wheee!

FastScripts from Red Sweater Software is $9.95
Logic Pro X 10.4.8, 10.5.1, Logic Pro 10.6.1
OS X 10.15.7, macOS 11.1
iMac19,1 27" - 3.6 GHz Intel 8 Core i9 - 40GB memory - MacBook Air - 3.2 GHz M1 - 16GB memory - 1TB SSD
Behringer XR18 - Behringer X-Touch - iPad Pro 10.5" iOS 14.3
Logic Pro Command of the Day
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Tue Jul 17, 2018 8:31 am

I'm using Keyboard Maestro. It works if I click to run the macro, but if I try to actually hit the hotkey I set (ctrl - option - up arrow) it just flashes. I've checked and this isn't set for anything else in Logic. Usually it flashes when you hit a hotkey that hasn't been set to anything, correct?

I guess I can mess with different hotkeys. Not sure why this is happening.
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Tue Jul 17, 2018 8:36 am

Screen Shot 2018-07-17 at 11.35.20 AM.png
Screen Shot 2018-07-17 at 11.35.20 AM.png (75.71 KiB) Viewed 7436 times


This is what my macro looks like
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Tue Jul 17, 2018 8:37 am

I figured it out. In Maestro Key you don't just have to enable the macro itself but the group folder. Once I enabled it, works like a charm. Thanks for this script! I've literally looked for this for years...
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Thu Aug 23, 2018 9:18 am

One issue I've noticed with this is if I have a movie in the side panel it messes it up. Any idea how to fix this?
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
speakerfood
Topic Author
Posts: 111
Joined: Sun Mar 21, 2010 2:48 pm
Location: Netherlands
Contact:

Re: Change Region Gain With Key Commands

Wed Sep 19, 2018 2:17 am

morganmd7 wrote:
One issue I've noticed with this is if I have a movie in the side panel it messes it up. Any idea how to fix this?


It changes the numbering of the windows in the side panel, probably.
I will try to figure out how to access GUI elements by their name instead of index.
Don't know if this is possible. Would make this script a little bit more future proof.
 
speakerfood
Topic Author
Posts: 111
Joined: Sun Mar 21, 2010 2:48 pm
Location: Netherlands
Contact:

Re: Change Region Gain With Key Commands

Wed Sep 19, 2018 12:35 pm

Here's an improved version of the script. It works as long as you don't put the string "- Tracks" in the name of your session, which is very unlikely I guess.

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"
tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window
set x to (get value of slider 1)
set value of slider 1 to (x + 10)
end tell
end tell
end tell
end tell
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Mon Sep 24, 2018 2:14 pm

Awesome! well done. This is such a useful hack, it should be sticked somewhere.
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Change Region Gain With Key Commands

Tue Sep 25, 2018 10:09 pm

speakerfood wrote:
Here's an improved version of the script. It works as long as you don't put the string "- Tracks" in the name of your session, which is very unlikely I guess.

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"
tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group 2 of window tracks_window
set x to (get value of slider 1)
set value of slider 1 to (x + 10)
end tell
end tell
end tell
end tell


Hmmm, just tried this script and it doesn't appear to be working. The very first script you posted worked, but liked morganmd, I ran into problems with it not working when there was a movie in the project. Any help?
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Fri Nov 02, 2018 7:19 am

It actually stopped working for me as well... Not sure why :(
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
speakerfood
Topic Author
Posts: 111
Joined: Sun Mar 21, 2010 2:48 pm
Location: Netherlands
Contact:

Re: Change Region Gain With Key Commands

Fri Nov 02, 2018 8:08 am

The movie window messes up the UI Elements order. If you use a seperate window for the movie it should work.
And here is an update to the script:

tell application "Logic Pro X 10.3.0"
tell application "System Events"
tell process "Logic Pro X"
set tracks_window to title of first window whose title contains "- Tracks"
if (description of group 1 of window tracks_window = "Control Bar") then
set group_nr to 2
else
set group_nr to 1

end if
tell row 8 of outline 1 of scroll area 1 of group 1 of list 1 of group group_nr of window tracks_window
set x to (get value of slider 1)
set value of slider 1 to (x + 10)
end tell
end tell
end tell
end tell

BTW: I'm on 10.12.6. Maybe High Sierra or Mojave also has influence on the interface.
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Fri Nov 02, 2018 12:24 pm

Ok. It works if I have the movie float. Let me know if you figure out how to get it to work with the movie still in the top left corner.
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
morganmd7
Posts: 58
Joined: Thu Jul 29, 2010 6:37 am
Location: Scaly Mountain, NC
Contact:

Re: Change Region Gain With Key Commands

Fri Nov 02, 2018 1:00 pm

Ok. It works if I have the movie float. Let me know if you figure out how to get it to work with the movie still in the top left corner.
http://www.MatthewMorgansMusic.com

Composer//Sound Designer

iMac (mid 2011) 2.7 GHz i5 - SATA SSD - 24 GB RAM - Logic 10.3.2

Logic 10.0.7, OS 10.10.1, MacBook Pro (Retina, 15-inch, Late 2013), 16 GB RAM, 2.3 GHz Intel Core i7
 
User avatar
anp27
Posts: 1728
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Change Region Gain With Key Commands

Fri Nov 02, 2018 6:02 pm

Yes, I too would like to know how to get this working with the movie still in the top left corner (without Movie float)
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM Macbook Pro 15" (early 2011) 2.3 Ghz i7~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.1~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61