Running an AppleScript using BTT shortcut integration?

I want to create a shortcut that will toggle bluetooth on, set it to my AirPods and randomly play my recently added songs on Apple Music.
I want to set the correct output using an AppleScript. Is there a way to create a BTT without any specific trigger (keyboard, mouse or otherwise) that I can summon using "Execute named trigger" in the shortcuts app ?

1 Like

Apple's Shortcuts app can run AppleScripts from within them.. It also supports shell/bash commands.. So I'm not seeing your need for BTT if you're wanting to use Shortcuts to initiate the actions. All you're wanting to do can be done directly in the Shortcuts app.

However, you can have BTT active a "Shortcut" via multiple of options..

Whit this code you can change output of audio, change nameOfYourDeviceToChange in the code for your device name like appear in your audio preferences

tell application "System Preferences"
	reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"
	tell table 1 of scroll area 1 of tab group 1 of window 1
		delay 1
		select (row 1 where value of text field 1 is "nameOfYourDeviceToChange")		
	end tell
end tell

for example "MacBook Pro Speakers" or the name of your AirPods

for play your recently add song you can do this:
Create a smart playlist (Music > File > New > Smart Playlist) that add automatically song recents whit this configuration.

In app shorcuts, create one shorcut with this configuration:

Where say Get Song in select your the Smart Playlist

Then in BetterTouchTool, create a new button whit this configuration:


in shorcuts: Uncategorized should be appear the name of smart playlist, also before the shortcut add the script to change the device output

I hope it works