I was trying to retrieve the file location from the current itunes track with this script :
on open info
tell application "iTunes"
set songLocation to get location of current track
end tell
return songLocation
end open
and then the code :
desc = [_getFileLocScript runScript:someScript];
result = [desc stringValue];
NSLog (@"%@", result); //it shows null value.
NSLog (@"%@", desc); //it shows some numbers and key "alis".
Output :
<NSAppleEventDescriptor: 'alis'($000000000232000200000A4C656F7......FFFF0000$)>
Question is, what actually returned from the iTunes’ applescript for this file location information?
Applescript-style paths are a little different than you’re probably used to. As such the easiest thing for you would be to get a path in the style you would prefer. So in your applescript code I would change your line of code to this to get a slash delimited string e.g.. /Users/username/Desktop/somefile.txt
Then once you have the returned value in cocoa, you can see that desc is an NSAppleEventDescriptor. So if you look that up in the documents, you will see that it does not have a “stringValue” method, however it does have a “string” method so use that. As such change your line to this…