Hi. I'd like to have a button that dynamically opens whichever app is playing audio. Is this possible with BTT and/or Shortcuts/AppleScript?
1 Like
What kind of button?
BTT has a built in variable for the currently playing app. You can use it in a script like this:
(async ()=> {
// get the currently playing app bundle identifier
let result = await callBTT('get_string_variable', {variable_name:'BTTCurrentlyPlayingApp'})
// use the macOS open command to open the app with this identifier
let shellScript = `open -b ${result}`;
let shellScriptWrapper = {
script: shellScript,
launchPath: '/bin/bash',
parameters: '-c',
environmentVariables: ''
};
await runShellScript(shellScriptWrapper);
returnToBTT(result);
})();
1 Like
Ah I totally missed that variable when looking through the docs... exactly what I was looking for - thanks!
Im using it for a button in my notch bar - I've been hugely impressed so far. I got BTT years ago for the express purpose of swiping between program tabs with 3 fingers... and now I use it for so so so much more than that. Thanks for all you do Andreas! Best app for Mac hands down