Pages

Friday, August 9, 2013

Re: ApplescriptObjectiveC (ASOC): setLabel:forSegment:

1.  Call method was an AppleScript Studio command to call an arbitrary Cocoa method.  This is not needed in ASObjC since it calls the various Cocoa methods directly.

 

2. The regular (free) Objective-C/Cocoa documentation is apparently what Apple expects you to use.  There are a few ASObjC specific resources, for example MacScripter's AppleScriptObjC in Xcode tutorials, but the best documentation is still Shane Stanley's excellent AppleScriptObjC Explored ebook (not free).

 

3. One of the big differences with AppleScriptObjC (as you have found out) is the naming convention when using Cocoa methods.  Instead of the names and arguments being mixed, the equivalent ASObjC method uses a more or less standard AppleScript handler name with underscores as placeholders for the arguments, so your example NSSegmentedControl statement would be:

    logintextbutton's setLabel_forSegment_("Delete", 2)

 

See the AppleScriptObjC Release Notes for information about converting from Objective-C (there are also some conversion scripts out there that will convert methods from the documentation).


View the original article here

0 comments:

Post a Comment