You can use the FoneMonkey API to create a script. Use the FoneMonkeyAPI static playCommands method to add commands to the current script.
/**
Play the supplied array of FMCommandEvents.
@return nil if all comamnds run successfully and an error or failure message otherwise.
*/
+ (NSString*) playCommands:(NSArray*)commands;
You can create an FMCommandEvent with following FMCommandEvent static method.
/**
Create a new FMCommandEvent
*/
+ (FMCommandEvent*) command:(NSString*)cmd className:(NSString*)name monkeyID:(NSString*)id args:(NSArray*)array;
Example
- (void) testSomething {
NSMutableArray* array = [NSMutableArray array];
[array addObject:[FMCommandEvent command:@"Touch" className:@"UITabBarButton" monkeyID:@"GLPaint" args:nil]];
NSString* lastResult = [FoneMonkeyAPI playCommands:array];
STAssertNil(lastResult, lastResult);
}