Geektool + AppleScript

Here's a little script I've written for Geektool, a fine little app to display information on the desktop.
You can get the whole shebang here.

This is the script:

global output

tell application "System Events"
set myList to (name of every process)
end tell

if (myList contains "Cog") is true then
tell application "Cog"
if (exists artist of the currententry) then
set this_artist to (get artist of the currententry)
else
set this_artist to " ?"
end if
if (exists title of the currententry) then
set this_title to (get title of the currententry)
else
set this_title to "dunno"
end if
end tell
set output to "currently playing: " & this_title & " by " & this_artist

else
set output to "Cog not running"
end if
do shell script "echo " & quoted form of output

No comments:

Post a Comment