Time Out Free & Applescript control of Songbird

Time Out Free is a great app for those of you like me who need reminding when to take a break from the screen.

One of Time Out Free’s features is the ability to run an Applescript when breaks start and end. I wanted to pause then resume my music from playing to add extra emphasis that it was break time.

Unfortunately Songbird (my choice music app) didn’t have an Applescript Dictionary so I had to simulate mouse clicks for the play/pause action.

I created 2 scripts – the one below to pause the music, and a modified version to resume playing.

This script can be run from any app that allows Applescript integration.

Hope it helps someone.

to pauseSongbird()
	tell application "System Events"
		tell process "Songbird"
			tell menu bar 1
				tell menu bar item "Controls"
					tell menu "Controls"
						set state to get name of menu item 1
						-- display dialog state
						if state is equal to "Pause" then
							click menu item 1
						end if
					end tell
				end tell
			end tell
		end tell
	end tell
end pauseSongbird

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning

if appIsRunning("Songbird") then
end if


Credit to Sebastian Wains for the running processes check.

Leave a Reply