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!







Leave a comment