2-button Keyboard shortucut to Control SoundSpeaker Balance

Mac OS 10.10.1
Applescript 2.4

Hello All:

Issue:
It’s easy enough with a number of options to adjust volume via two keyboard buttons, slider at the top of my screen, or a slider within what ever music app i’m using (usually iTunes). But I see no quick and easy way to adjust the speaker and headphone balances (the only two output devices I use with my iMac), so my only option is System Preferences/Sound/Output/Balance.

Query:
Is there some control or shortcut I am missing or can an Applescript be used to assign two buttons for moving the balance leftward, rightward (is that a real word?) or in the middle with pretty much equal output of the two speakers?

Caveats:

  1. I would rather it eases the shift much like the volume works.
  2. I would rather not install an app for playing my music and stick to iTunes if at all possible.

(According the Mr. Schumann, my HS English teacher, do not thank in advance), so.
thank you for anything that can either point me in the right direction, or help me write out an Applescript.

BG

Balance to right:

set wantedpane to "Sound"
set wantedanchor to "Output"

tell application "System Preferences"
	--activate
	run
	reveal anchor wantedanchor of pane id ("com.apple.preference." & wantedpane)
end tell

tell application "System Events"
	tell application process "System Preferences"
		set a to value of slider "Balance:" of group 1 of tab group 1 of window "Sound"
		set a to a + 0.1
		if a is greater than 1 then set a to 1
		set value of slider "Balance:" of group 1 of tab group 1 of window "Sound" to a
	end tell
end tell
return a

Balance to left:

set wantedpane to "Sound"
set wantedanchor to "Output"

tell application "System Preferences"
	--activate
	run
	reveal anchor wantedanchor of pane id ("com.apple.preference." & wantedpane)
end tell

tell application "System Events"
	tell application process "System Preferences"
		set a to value of slider "Balance:" of group 1 of tab group 1 of window "Sound"
		set a to a - 0.1
		if a is less than 0 then set a to 0
		set value of slider "Balance:" of group 1 of tab group 1 of window "Sound" to a
	end tell
end tell
return a

You’ll probably want to convert these scripts to Automator Actions and apply keyboard shortcuts to them.

Thank you partron22. Would an Automator command to run this as an Applescript work?

BG

Yes, New Workflow: Execute AppleScript. But first you’ll have to add Automator.app to the list of Apps that are allowed to control your computer.
You can do that in the “Privacy” pand of the “Security and Privacy” System prefs:
Just unlock, click the + button and look around in your Apps folder until you find the Automator app.