Is it possible to call an Objective-c class from AppleScript in OSX 10.7?
I have seen some suggestions for Snow Leopard or earlier, but none seem to work.
AppleScript-Obj-C seems to be a way of constructing a GUI which uses AppleScript, but I want to call a class I have written from a script.
The following (which does not work) is what I would like to do:-
on getJpegComment(photoFile)
set aJpeg to call method "initWithPath" of class "JpegCom" with parameter photoFile (does not work)
return call method "comment" of aJpeg
end getJpegComment
tell application "iPhoto"
tell album "Sale"
set thePhotos to get every photo
end tell
repeat with aPhoto in thePhotos
tell application "iPhoto"
set aPhotoFile to image path of aPhoto
set aComment to my getJpegComment(aPhotoFile)
set comment of aPhoto to aComment
end tell
end repeat
end tell
I started down this path because of links which seemed to indicate this was possible.
I could write an Objective-c program, which called AppleScript, but this seems overkill for seemed to be a simple task.
PS I have thousands of photos, which I had entered JPEG COMments of Windows, unfortunately iPhoto does not understand these.