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"
try
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)