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


Click here to return to the 'Try iChatStatus and These Scripts!!!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Try iChatStatus and These Scripts!!!
Authored by: HuntingBears on Aug 07, '03 11:23:03PM

There's a bug in the script which causes it to return a value before it has a chance to set the buddy icon. I've contacted the author of the script and he'll be posting an updated version on his site soon. In the meantime, here's a slimmed down version.

To use, copy and paste the following code into a new AppleScript document and save it in ~/Library/Application Support/iChatStatus/


tell application "System Events"
  if ((application processes whose (name is equal to "iTunes")) ¬
    count) is greater than 0 then
    tell application "iTunes"
      if player state is playing then
        set the_artist to artist of current track
        set the_song to name of current track
        if artworks of current track exists then
          set currentArt to data of front artwork of current track
          my iChatIconFromArtwork(currentArt)
        end if
        if the_artist is not missing value then
          return the_artist & " - " & the_song
        else
          return the_song
        end if
      else if player state is paused then
        return "iTunes is paused"
      else if player state is stopped then
        return "iTunes is quiet"
      end if
    end tell
  else
    return "iTunes is Off"
  end if
end tell

on iChatIconFromArtwork(inArt)
  tell application "System Events"
    if ((application processes whose (name is equal to "iChat")) ¬
      count) is greater than 0 then
      tell application "iChat"
        try
          set file_name to ":tmp:artwork2avatar.pict" as string
          try
            do shell script "rm /tmp/artwork2avatar.pict"
          end try
          open for access file_name write permission 1
          copy the result to file_reference
          write inArt starting at 0 to file_reference as picture
          close access file_reference
          set theImage to open for access file file_name ¬
            without write permission
          set imageData to read theImage as TIFF picture
          set image to imageData
          close access theImage
        on error errStr
          try
            close access file_reference
          end try
          display dialog "Error: " & errStr
        end try
      end tell
    end if
  end tell
end iChatIconFromArtwork



[ Reply to This | # ]
Try iChatStatus and These Scripts!!!
Authored by: konakona on Aug 07, '03 11:32:18PM

Wow! It works.

What an amazing bunch Mac users are!



[ Reply to This | # ]
Try iChatStatus and These Scripts!!!
Authored by: locklin on Aug 10, '03 07:18:45PM

Thanks a lot, now it works...

locklin



[ Reply to This | # ]