Getting iTunes Artwork

I’ve got the following code which works fine in Script Editor:

[code]on run
tell application “System Events”
set the process_flag to (exists process “iTunes”)
end tell
if the process_flag is false then
ignoring application responses
tell application “iTunes” to launch
end ignoring
end if

tell application "iTunes"
		set lib_ref to first library playlist
		set track_ref to first track of lib_ref
		tell track_ref
			if artworks exists then
				set artworkData to (data of artwork 1)
				return artworkData
			end if
			return null
		end tell
	end try
end tell
return null

end run[/code]

Then the code in Xojo always returns null:

[code]Dim xAppleScript As NSAppleScriptMBS
Dim dError As Dictionary
Dim xEvent As NSAppleEventDescriptorMBS

xAppleScript = New NSAppleScriptMBS(AppleScriptTunesArtwork)
Call xAppleScript.Compile()
xEvent = xAppleScript.Execute(dError)


Any ideas how to get iTunes song artwork?

Isnt there an entitlement you need for AppleScripting other apps ?

Yes, I am using:

<?xml version="1.0" encoding="UTF-8"?>

If you’re running Mojave, you also need to add the new “Privacy” bullshit to your plist file. Which can be done in App Wrapper 3.9.

If you have access to the file; you could try seeing if you can get the artwork via MDS or even reading the file’s meta data.

Yeah I’ve done that too but manually. No go. Not sure what’s up. I’ve just switched to media library MBs class instead

MLMediaObjectMBS ArtworkImage property may help.