Advanced player management

  1. Create a widget "Now Playing Widget"
  2. Set Predefined Action: "Run Apple Script (async in background)"
  3. Paste code:

# Clicks count
tell application "BetterTouchTool"
  set clicks to get_number_variable "MusicPlayerAction"
end tell

# First click
if clicks as string is "missing value" then
	set clicks to 0
end if

# Increase the number of clicks per unit
set clicks to clicks + 1

tell application "BetterTouchTool" to set_number_variable "MusicPlayerAction" to clicks

# Waiting
delay 1.2

# Current number of clicks
tell application "BetterTouchTool"
	set now_clicks to get_number_variable "MusicPlayerAction"
end tell

# Action
if now_clicks as number is clicks then
	tell application "BetterTouchTool" to set_number_variable "MusicPlayerAction" to 0

	tell application "BetterTouchTool"
		# Actions
		if clicks as number is 1 then
			# Next track
			trigger_action "{\"BTTPredefinedActionType\" : 27}"
		else if clicks as number is 2 then
			# Play/Pause
			trigger_action "{\"BTTPredefinedActionType\" : 23}"
		else if clicks as number is 3 then
			# Prev. track
			trigger_action "{\"BTTPredefinedActionType\" : 26}"
		end if

	end tell
end if

  • 1 click - Next track
  • 2 clicks - Play/Pause
  • 3 clicks - Prev. track