Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set iChat status message and icon to iTunes song Apps
I use iChatStatus and a custom/modified script to automatically change my iChat status to the current track playing in iTunes and display the cover of the album (if there is one). If there's no icon, it displays a picture of myself I have on the computer. Also, if iTunes is open but isn't playing a song, it clears the status message and puts my icon to my photo. Pretty cool little script. As a side note, you may need GraphicsImporter (giconvert) to convert the CD covers to ichat icons. Feel free to modify as desired to work for your individual tastes. Enjoy!
tell application "iTunes"
  if player state = playing then
    set theartist to artist of current track
    set thesong to name of current track
    if exists artworks of current track then
      set theData to data of (artwork 1 of current track)
      set theTiff to giconvert theData type "TIFF" resolution {32, 32}
    else
      set r to open for access file "Willis:Library:Webserver:Documents:me.jpg"
      set theTiff to read r as TIFF picture
    end if
    tell application "iChat"
      set status message to "iTunes:" & theartist & " - " & thesong
      set image to theTiff
    end tell
  else
    set r to open for access file "Willis:Library:Webserver:Documents:me.jpg"
    set theTiff to read r as TIFF picture
    tell application "iChat"
      set image to theTiff
      set status message to ""
    end tell
  end if
end tell
[robg adds: I haven't tested this one...]
    •    
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[12,039 views]  

Set iChat status message and icon to iTunes song | 10 comments | Create New Account
Click here to return to the 'Set iChat status message and icon to iTunes song' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set iChat status message and icon to iTunes song
Authored by: drsoos on Jul 12, '04 10:32:49AM

Why not use Status Symbol From IfThenSoft
www.ifthensoft.com
Its very aogod for this stuff and does so much more.



[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: alajuela on Jul 12, '04 03:46:20PM

Well, for one thing, right now it is not available at their website.



[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: alajuela on Jul 12, '04 04:09:00PM

As reproduced here, the script appears to have a problem; this line--set theTiff to giconvert theData type "TIFF" resolution {32, 32}--produces the error "Expected end of line, etc. but found identifier."



[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: axello on Jul 13, '04 02:42:15AM

And did you not forget to install the GraphicsImporter OSAX as the original author suggested? That osax provides the 'giconvert' command.



[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: alajuela on Jul 20, '04 12:43:35PM

Thanks, but no I did not forget to install it. It's the first thing I did.



[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: ngb on Jul 14, '04 12:33:36AM
You really should close your file, as leaving it open can cause problems if you try to move it, rename it, or delete it. Also, you've got the entire bit about reading the file in your script twice. In the interest clarity and modularity, consider the following:

set myPic to "Willis:Library:Webserver:Documents:me.jpg"
set theMessage to ""
set theData to 0

tell application "iTunes"
    if player state = playing then
        set theMessage to "iTunes:" & artist of current track & " - " & name of current track
        if exists artworks of current track then
            set theData to data of (artwork 1 of current track)
        end if
    end if
end tell

if theData is not 0 then
    set theTiff to giconvert theData type "TIFF" resolution {32, 32}
else
    set r to open for access file myPic
    set theTiff to read r as TIFF picture
    close access r
end if

tell application "iChat"
    set status message to theMessage
    set image to theTiff
end tell
The result is that all the calls to iTunes are together and separate from all the calls to iChat, which are also all together. You'll find code reuse and future editing much easier.

[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: DaMacGuy on Jul 14, '04 11:24:26PM
So, when I put the path to my prefered image why do I get a file not found error. The following line in ScriptEditor is highlighted...
open for access file myPic

And the path for my default buddy image is...
"cwaldrip:Pictures:me.gif"

I'm assuming (and that could be my problem) that my default buddy image doesn't have to be a jpg like in the example, nor does it need to be in ~/Library/Webserver/.

Am I missing something?

---
-DaMacGuy

[ Reply to This | # ]

Set iChat status message and icon to iTunes song
Authored by: ngb on Jul 15, '04 02:05:13PM
I think the problem is in the path you've defined. You need a full absolute path to the file you wish to open, such as "Macintosh HD:Users:cwaldrip:Pictures:me.gif". In this case I'm assuming that "cwaldrip" is your home directory. You could also use the shortcut path to Pictures folder, but that requires a bit of finessing as demonstrated here:

set picName to "me.gif"
set picPath to path to Pictures folder as text
set f to open for access file (picPath & picName)
close f
It would be really nice to be able to use reference the file as file "me.gif" of (path to Pictures folder), but Applescript chokes on that.

[ Reply to This | # ]
Set iChat status message and icon to iTunes song
Authored by: alajuela on Jul 20, '04 01:43:07PM

Anyone know why this wouldn't work with iTMS song purchases? The Default iChatStatus script recognizes and reports those songs, but this script does not. It is nice on the non-iTMS songs.



[ Reply to This | # ]
graphics converter link has changed
Authored by: alternapop on Jul 27, '05 03:57:13PM

http://osaxen.com/files/graphicsimporter2.2.html



[ Reply to This | # ]