The following program uses appscript to create a new "Hello World!" document in TextEdit:
#import <Foundation/Foundation.h>
#import "TEGlue/TEGlue.h"
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
TEApplication *textedit;
TEMakeCommand *makeCmd;
textedit = [[TEApplication alloc] initWithBundleID: @"com.apple.textedit"];
makeCmd = [[[textedit make] new_: [TEConstant document]]
withProperties: [NSDictionary dictionaryWithObjectsAndKeys:
@"Hello World!\n", [TEConstant text], nil]];
[makeCmd send];
[textedit release];
[pool release];
return 0;
}
Additional examples are included in the subversion repository.