So I need to display the current iTunes track image in my app, I have tried 100 different ways with no results.
what I have so far:
[logic] id there is art, get it create a file to the desktop, then use that file to display in my app.
so far so good, but I have tried “Image Well” and “Image View”
when I build image view, I get an uncaught exception thrown, so I have been trying image well.
here is the code I have tried:
[code]tell application “iTunes”
set myTrack to (current track)
set n to name of myTrack
set arts to artworks of myTrack
if arts = {} then
–display dialog “Il brano "” & n & “" non contiene artwork.” with icon 1
–return
else
set arts to item 1 of arts – a track can contain multiple artwork; we choose the first one
set imageData to data of arts
my writeImageFile(n, imageData)
end if
--set contents of theImageWell to myFile
--tell theImageWell to setImage_(myFile) as picture
--set image of theImageWell to load myFile
--theImageWell's setImage_(myFile) as picture
--aPopupMenu's addItemsWithTitles_(theMonths)
--set image of theImageWell to (myFile)
--theImageWell's setImage_(pathForResource_ofType_("AlertStopIcon", "icns"))
--tell class "NSImage" of current application to set thePic to imageNamed_("Chart.icns")
tell class "NSImage" of current application to set thePic to myFile
theImageWell's setImage_(thePic)
--set posPath to POSIX path of (choose file)
--set newImage to NSImage's alloc()'s initWithContentsOfFile_(posPath)
--theImageWell's setImage_(newImage)
end tell[/code]
so its a little messy but this represents all the things I have tried. How can I get an image to display in my app?
I am sure this is very simple, and I am relativley new to this.
Any ideas or help please? 12 hours is enough time on this!!
using xcode 10.6 applescript application
cheers,
bo