Sailing Clicker Scripting

From: macosxhints - Get the most from X!

Here is an example AppleScript that highlights a new feature of Salling Clicker (as of version 2.0): displaying transient floating centred images.

This AppleScript displays album artwork for the track currently playing in iTunes. It is not in any way Bluetooth related, so does not require ownership of any Bluetooth devices, but requires iTunes 4.0.1, Salling Clicker 2.0, and Clutter 1.0d14 . I happen to keep my album artwork separate from my iTunes music library. Clutter (by Sprote Rsrch) helps me with this, and keeps small jpgs of album covers in a subfolder of ~/Library/Images/. allmusic.com helps me with the covers Clutter doesn’t find on Amazon.

The script uses Clutter’s storage scheme, but could easily be adapted to extract the artwork directly from the mp3 or aac, if you’ve added artwork to iTunes that way. Save the script in ~/Library/Scripts/ and give it a name like “Show Album Cover”. It will then be accessible from the Script Menu Extra … or if you do have a Salling Clicker compatible phone, you can link the script up in the usual way. When the script is run, artwork for the current track’s album (if available) is displayed on the centre of the screen in a cool fashion.

OS version: OS X

--Mac OS 10.2.6 (although hacking allows it to work on earlier versions)
--iTunes, [url=http://www.apple.com/itunes/]http://www.apple.com/itunes/[/url]
--Clutter, [url=http://www.sprote.com/clutter/]http://www.sprote.com/clutter/[/url]
--Salling Clicker, [url=http://homepage.mac.com/jonassalling/Shareware/Clicker/]http://homepage.mac.com/jonassalling/Shareware/Clicker/[/url]

set image_folder to (path to current user folder as string) & ¬
  "Library:Images:com.sprote.clutter:CDs:"

tell application "iTunes"
  if player state is playing then
    set theAlbum to the album of the current track
    set theArtist to the artist of the current track
    set image_path to image_folder & theArtist & ":" & theAlbum & ".jpg"
            
    tell application "SEC Helper"
      try
        set the_picture to read (alias image_path) as picture
        show screen picture the_picture duration 5
        on error
          show screen message "No album cover available"
      end try
    end tell
  end if
end tell