appscript

About objc-appscript

Please note that appscript is no longer developed or supported, and its use is not recommended for new projects.

Objective-C appscript (objc-appscript) is a high-level Apple event bridge that allows you to control scriptable Mac OS X applications from Objective-C programs.

For example, to get the value of the first paragraph of the document named "ReadMe" in TextEdit:

TEApplication *textedit = [TEApplication applicationWithName: @"TextEdit"];

TEReference *ref = [[[[textedit documents] byName: @"ReadMe"] paragraphs] at: 1];

NSString *result = [[ref get] send];

This is equivalent to the AppleScript statement:

tell application "TextEdit"
    get paragraph 1 of document "ReadMe"
end tell

ObjC-appscript supports MacOS X 10.4 and later.