Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript-Cocoa Impedance Mismatch



I have two impedance mismatches between my sdef and my application, and I'm wondering the best way to deal with them. The application is Leopard-only, so AppleScript 2.0 solutions are A-OK.

First, there are several properties that are lists in AppleScript, but token-delimited strings in the application. What I ended up doing is overriding setValue:forKey: and valueForKey: in the application class, checking for the affected keys, then doing the conversion manually.

While trivial, I'd rather have something that's only activated when used from AppleScript, and generic enough I don't have to implement a bunch of methods for every affected key. Ideally, there'd be scriptingSetValue:forKey: and scriptingValueForKey: methods I could just use, but that doesn't seem to be the case.

Second, we have a class, "medium," that has several different types. In the application, these are all the same class, but in AppleScript, that leads to this rather awkward construction:
make new medium with properties {type:"book",...}
first medium whose type is "book" and...

Creating subclasses in the sdef allows me to "filter out" properties that don't apply to a given medium, so, say, the movie subclass would have cinematographers, but the book subclass would not. However, that still doesn't let me do what I'd really like:
make new book with properties...
first book whose...

Is there a way to translate "book" to "media whose type is book" on the fly, either in the sdef (along the lines of synonyms), or in code? I mean, I guess I could override every single verb, but that seems like a lot of extra work...

Cheers,
Mike Lee, Major-domo
Delicious Monster Software, LLC
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.