How do I add artwork to an iTunes track with obj-c AppleScript?

Posted by demonslayer319 on Stack Overflow See other posts from Stack Overflow or by demonslayer319
Published on 2010-03-10T01:15:25Z Indexed on 2010/03/11 18:34 UTC
Read the original article Hit count: 344

Filed under:
|
|
|

aTrack is an ITReference* object, value is an NSImage* object, initialized via a URL to a jpeg.

[[[[[aTrack artworks] data_] set] to:value] send];

I get the following message in GDB:

2010-03-09 16:59:42.860 Sandbox[2260:a0f] Can't pack object of class NSImage (unsupported type): <NSImage 0x10054a440 Size={0, 0} Reps=(

I then tried the following code:

NSData *imageData = [[NSData alloc] initWithData:[value TIFFRepresentation]];
[[[[[aTrack artworks] data_] set] to:imageData] send];

and get this message instead

2010-03-09 16:46:09.341 Sandbox[2193:a0f] Can't pack object of class NSConcreteData (unsupported type): <4d4d002a 00000000>

In the AppleScript documentation, it says that the "data" property of the "artwork" item is a PICTPicture image.

How do I convert an NSImage to a PICT? Am I using the AppleScript all wrong?

© Stack Overflow or respective owner

Related posts about applescript

Related posts about cocoa