Itunes artwork in image view

I was wondering if anybody could help me figure out how to display the artwork of the selected song in itunes in an image view box id applescript studio. I am able to get the data for the the picture but the image view can’t read it.

Model: Dual 1Ghz MDD
Browser: Firefox 2.0.0.3
Operating System: Mac OS X (10.4)

Read jubo’s post: http://bbs.applescript.net/viewtopic.php?pid=66574#p66574

Hi,

I am putting this reply back in the original thread though you had posted your query in another related thread.

I noticed that you had successfully implemented jobu’s code to display the album art of iTunes’ track in the image view but can’t make the view change to a new image when the track changes.

You can use jobu’s “notification” method if you can do it. Else, a simple AppleScript could do it for you, probably not as efficient as jobu’s notification method, but perhaps easier to grasp.

To do it in AppleScript, let me outline the basic steps you can play around with:

  1. In “on awake from nib”, check if iTunes is playing. If not, make it play because you will need info from an active track. The info you will need, if we’re just talking about monitoring the track changes, is the database ID of the track (I assume this is unique though it may not completely be but should be good enough to use for now until you can identify a more dependable parameter). So, store the database ID in a variable, say “dbidThisTrack”.

  2. Then make an idler handler that has inside it another handler that checks if iTunes had changed tracks. You will get the info about the database ID of the active track in that handler and compare it with the stored ID (dbidThisTrack).

  3. If the ID had changed, then the track had updates so make your code change the image in the image view to the album art of the new track. After you ad done this, then store the new database ID to the variable dbidThisTrack for use in the next round of monitoring if the track had changed. Don’t forget to do this else the image will be updated to the same thing every time your application idles.

  4. If the ID hasn’t changed, that means the track hasn’t changed so do nothing except to continue to idle (or do something else, if you wish, except to change the image in the image view).

  5. In the idler, put in a return statement (a simple return is equal to 1 or use a number that is not too far off from 1 so that the updating is more or less instantaneous as the checking of the tracks would be done more frequently)

The above should do the job for you.

That’s it. I hope this gives you the general idea.

Good luck.

archseed :slight_smile:

Thanks for the help. Works great