Re: Where are the boundaries of Cocoa and how are the boundaries perceived ?

  • on 2007-10-01 8:06 PM, Nir Soffer at <nirs...> 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
    <>) 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 - <bill...>
    Quechee Software, Quechee, Vermont, USA

    PreFab Software -
previous month october 2007 next month
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today