Detect the presence of your Bluetooth device and execute actions on your Mac.

BlueSense analyzes the signal of your Bluetooth device and executes any desired actions when you move or come back at proximity of your Mac.

BlueSense requires OS X 10.10 or later
BlueSense AppleScripts

How to pause Spotify player for Mac in AppleScript

Change the status of Skype to AWAY (if ONLINE and running).

script SpotifyPlayPause
	tell application "System Events"
		set runningApp to processes whose bundle identifier is "com.spotify.client"
	end tell

	if runningApp is not {} then
		tell application "Spotify" to pause
	end if
on error errString number errorNumber
	log (errString)
end try
end script