Audio Settings Autoload

I’ve automated opening GP with it’s instances with an AppleScript

GP Instance Selector (Applescript)

I’d also like to automate changing audio settings for each instance.

Here is a script I came up with that can do this, but it is not very consistent and frequently gets derailed. It uses a .py script with library pyautogui to find and click the Load Audio Settings button executed with AppleScript.

AudioChange.py

--------------

Finds and clicks the “Load Audio Configuration” button in Gig Performer,

then pastes the config file path into the dialog.

Usage:

python AudioChange.py "/path/to/config.gpaudiosettings"

“”"

import pyautogui

import pyperclip

import sys

import time

BUTTON_IMAGE = “/Users/samsonandersson/Pictures/Screenshots/Load Audio Button.png”

CONFIDENCE = 0.9

if len(sys.argv) < 2:

print(“ERROR: No config file path provided.”)

sys.exit(1)

CONFIG_FILE_PATH = sys.argv[1]

# Find and click the Load Audio Configuration button

location = pyautogui.locateCenterOnScreen(BUTTON_IMAGE, confidence=CONFIDENCE)

if location is None:

print(“Button not found. Try lowering CONFIDENCE.”)

sys.exit(1)

print(f"Found at {location} — clicking…")

pyautogui.click(location)

time.sleep(0.6)

# Move mouse away from Load button to prevent tooltip blocking Apply Settings

pyautogui.moveTo(100, 100, duration=0.3)

# Paste path into file dialog

pyperclip.copy(CONFIG_FILE_PATH)

pyautogui.hotkey(‘command’, ‘shift’, ‘g’)

time.sleep(2.5)

pyautogui.hotkey(‘command’, ‘v’)

time.sleep(0.5)

pyautogui.press(‘return’)

time.sleep(1.0)

pyautogui.press(‘return’)

print(“Done.”)

The AppleScript

– ── BUBBLE ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Bubble to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9007).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load Bubble audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Bubble.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 1

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 3

-- ── SPRANG ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Sprang to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9009).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load Sprang audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Sprang.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 1

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 3

-- ── CHOIR ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Choir to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9001).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load Choir audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Choir.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 1

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 5

-- ── GREAT ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Great to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9002).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load Great audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Great.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 2

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 5

-- ── SWELL ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Swell to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9003).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1.5

-- Load Swell audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Swell.gpaudiosettings\”"

delay 3

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 2

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 6

-- ── PEDAL ────────────────────────────────────────────────────────────────────

-- Send OSC to bring Pedal to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9004).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load Pedal audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/Pedal.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 2

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 6

-- ── DRUM MACHINE ─────────────────────────────────────────────────────────────

-- Send OSC to bring DrumMachine to front

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python -c \“from pythonosc.udp_client import SimpleUDPClient; SimpleUDPClient(‘127.0.0.1’, 9014).send_message(‘/GPWindowToFront’, [])\””

delay 2

-- Open Audio Setup window

tell application “System Events”

**tell** (**first** *process* **whose** frontmost **is** *true*)

	**tell** *menu bar* 1

		**tell** *menu bar item* "Options"

			**tell** *menu* "Options"

				**click** *menu item* "Audio Setup..."

			**end** **tell**

		**end** **tell**

	**end** **tell**

**end** **tell**

end tell

delay 1

-- Load DrumMachine audio config

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Desktop/Live Rig/Scripts/Python/AudioChange.py\" \“/Users/samsonandersson/Documents/Gig Performer/AudioSettings/UCX II/DrumMachine.gpaudiosettings\”"

delay 1.5

-- Dismiss completion dialog

tell application “System Events”

**key code** 36

end tell

delay 2

-- Click Apply Settings

do shell script “source /Users/samsonandersson/gp-automation/venv/bin/activate && python \”/Users/samsonandersson/Documents/Scripts/Apply Button.py\“”

delay 2

Any suggestions on how to tighten this up?