Re: Where are the boundaries of Cocoa and how are the boundaries perceived ?
Re: Where are the boundaries of Cocoa and how are the boundaries perceived ?
- Subject: Re: Where are the boundaries of Cocoa and how are the boundaries perceived ?
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 02 Oct 2007 07:18:59 -0600
- Thread-topic: Where are the boundaries of Cocoa and how are the boundaries perceived ?
on 2007-10-01 8:06 PM, Nir Soffer at email@hidden wrote:
> Who informed you?
The responsible Apple engineers, but only with respect to the points
discussed below.
> Why OSAScript is preferred over NSAppleScript?
I had complained quite some time ago that -[NSAppleScript
executeAndReturnError:] fails to save the value of properties whose values
change as a result of script execution. AppleScript specifies that property
values should be persistent.
A lot of list traffic at the time was focusing on the failure of several
popular script runner applications to save changed properties, and I deduced
that it was because they were relying on this method. I worked around the
problem in my own app (PreFab UI Actions, at
<http://PreFabSoftware.com/uiactions/>) by writing my own
-executeSaveAndReturnError method using lower-level AppleScript API.
Later, as a result of my complaints, Apple advised me that they had fixed
the issue -- but only in OSAKit.framework, not in NSAppleScript -- by adding
new methods -[OSAScript writeToURL:ofType:error:] and -[OSAScript
writeToURL:ofType:usingStorageOptions:error:]. I now use one of them in
conjunction with -[OSAScript executeAndReturnError:] to save changed
property values.
There are several other methods in OSAKit with no NSAppleScript counterparts
that developers of script runners might find useful.
Once you switch from NSAppleScript to OSAKit, there may not be be any reason
to continue using NSAppleScript.
For older list traffic on this issue, search the applescript-implementors
list archives.
(If you try OSAKit yourself, don't forget that it has to be explicitly
included in your Xcode project's linked frameworks group and imported into
your code files, because it isn't included in Cocoa.h.)
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden