Still slaving away on this application to transfer annotations between iView MediaPro and Aperture. I am still running version 2.6.4 of iView, having decided to hold off on the upgrade to iView 3.0 for the moment. I discovered today that the AppleScript annotation records suite between the two applications has changed dramatically. Several property names have changed and more have been added in iView 3.0. For instance, the caption property is now named description. Annotation writer is now description writer. The list goes on. This throws a wrench in my AppleScripts, since you can’t easily reference non-existent properties in an application’s dictionary. Since people might have both versions of iView installed on a single computer, this may cause problems while running my app.
Update: Here’s what you get for not keeping up with updates! Yesterday, iView released an update to version 3.0.1. They added aliases back to the dictionary terms from iView 2.6.4. I still think I need the workaround to handle the case for the properties that exist in 3.0 but don’t exist in 2.6.4, such as creator address, creator URL, etc. So, I guess all the work below wasn’t for naught.
Update #2: HoloCore’s Jacob tells of a way to deal with dictionary classes by using the raw 4-letter code for specifying classes. Is there a way to see any hidden classes used by an application? Is it possible to have a AppleScript property that is accesible in scripts but not viewable in the application’s dictionary?
Prior to learning about version 3.0.1 of iView, here’s the hack that I used to work around the problem. AppleScript doesn’t let you reference property names using variable strings. For instance, you can’t do this:
set theAnnotationName to "description" return theAnnotationName of theAnnotations
You have to explicitly refer to it with
if theAnnotationName is "description" then return description of theAnnotations end if
Now you can see how having two different names for a property can cause problems. The workaround is to create a run-time script:
using terms from application "iView MediaPro" set s to "on run {r}" & return set s to s & "get " & theAnnotationName & " of r" & return set s to s & "end" try set theAnnotation to run script s with parameters {theAnnotations} return theAnnotation on error return false end try end using terms from
I found this workaround in Matt Neuberg’s excellent book AppleScript: The Definitive Guide. It replaced Danny Goodman’s good AppleScript book, which I had for over a decade.
The problem with this workaround is performance. Doing lookups of this nature takes far longer than simply specifying the property name. For the time being, however, I’m going to stick with the workaround. If anyone knows how to deal with dueling application dictionaries, let me know!
iView’s changes were very annoying, I spent far too long trying to keep on top of it whilst updating my app PictureSync (for which I’m currently investigating the process of adding Aperture support—which is how I found your site). Initially as you saw they changed both some names, but also all class codes (last char become uppercase), latterly they’ve reverted back to the original class codes (last char is lower case). When you compile a script it is saved with just the class codes, which is why if you compiled against the bad 3.0 classes scripts would no longer function with 2.x.
You can use class codes inside your script explictly e.g. «class pA0e» will give you the keywords (it was «class pA0E» in the bad early release of 3.0) which makes it possible to reference properties and items that don’t exist in the dictionary you are compiling against. To avoid errors referencing this in any case just use an if and check for the version e.g.:
— I was having problems using a straight version comparison, thus this less than elegant method
if first character of (get version) as string is not “2” then return url
Presumably you’re doing this script so you can avoiding altering your original files with IPTC/XMP embedded from MediaPro? I haven’t done much testing yet, but Aperture does import both, although I’m not sure about RAW sidecars.
Jacob – Thanks for the tips! I sent you an email with further information and questions.
Is there any reason you don’t use DNG and sync your annotations to the DNG file?
(I know everyone’s always paranoid about applications corrupting your data, but it seems as likely as any other cosmic event, though. Are there actual known issues?)
Is there some reason you don’t want to Sync the annotations in iVMP to the original files and then just import to Aperture normally?
Annotated RAW files don’t get their annotations imported in Aperture. JPEGs and TIFFs do, but not the RAW file. The annotations are still there in the file, Aperture just doesn’t touch them.