Button to show current player

Is there any way of creating the button to bring the current player to front?
I have seen that there is a widget "Currently Playing" but I had problems to use it just as a button without any texts.

Create a button, assign a script action and paste the following script:

tell application "BetterTouchTool"

set playerBundleIdentifier to get_string_variable "BTTCurrentlyPlayingApp"

end tell

tell application id playerBundleIdentifier


end tell
1 Like

Thank you @rishifter! Is there any way to make it work also if one closes the player window with x and it stays in background? activate does not recall such window.

I tried start or open but both didn't work. I haven't managed to find any Apple Script reference.

Add reopen after activate. That should work.

1 Like

Works like a charm! Thank you!

May I ask you what are you using as the reference when writing such scripts? I would like to slightly extend it, but am not sure what should I use. I tried looking for reference before without any results.

Sure. Open the Script Editor app on the Mac and go to Window->Library. It shows a list of apps that support scripting. When you pick an app, it lists all the possible dictionary of terms you can use with that app. That should work in most cases and there's google for the rest.

1 Like