4. Getting Help
ASDictionary
ASDictionary, available from the appscript website's tools page, provides a convenient GUI interface for exporting application terminology resources in plain text and HTML formats, as well as generating objc-appscript glues.
ASTranslate
ASTranslate, available from the appscript website's tools page, provides a simple tool for translating application commands from AppleScript to Objective-C syntax - useful when help is needed in converting existing AppleScript code to Objective-C. For example, the following AppleScript selects every file in the Home folder:
tell application "Finder"
select (every file of home whose name extension is in {"htm", "html"})
end tell
To obtain the appscript equivalent, paste this script into ASTranslate and select Execute from the Document menu. ASTranslate will intercept any Apple events sent by AppleScript and display them appscript format:
#import "FNGlue/FNGlue.h"
FNApplication *finder = [FNApplication applicationWithName: @"Finder"];
FNReference *ref = [[[finder home] files] byTest:
[[FNIts nameExtension] isIn: [NSArray arrayWithObjects: @"htm", @"html", nil]]];
id result = [[ref select] send];
OK
See ASTranslate's documentation for more information.
Notes
While appscript's help tools try to be reasonably forgiving of flawed or faulty terminology resources, there may be a few particularly problematic applications on which they fail. Should this happen, you can use ASDictionary to export the application's terminology in plain text format instead.
Other sources of help
- The
sampledirectory in the objc-appscript trunk contains sample projects demonstrating some common tasks. - Refer to any scripting documentation and example scripts supplied by the application developer.
- Look for third-party scripts that provide examples of use (though many of these scripts will be written in AppleScript rather than ObjC).
- The appscript website has links to mailing lists and other general resources.