ApplicationScripting.framework

From iPhone Development Wiki
Jump to: navigation, search
ApplicationScripting.framework
Private Framework
Availabile 3.0 – present
Class Prefix AS

ApplicationScripting is a simulator-only interface framework to allow users to use scripts (e.g. Javascript) to control the applications.

The ApplictionScripting framework can be located in the conventional location /System/Library/PrivateFrameworks/, or mounted to the folder /var/debug_mount/System/Library/PrivateFrameworks/ which the device can supposedly use as well.

This framework is not used anywhere in the SDK. It should be used only for Apple's internal testing.

API

ApplicationScripting can support a self-hosted scripting server/client. The server only needs to call ASInitialize() on start, and ASDestroy() on exit.

The client can request script to be evaluated on the server by the ASSendScriptingEventWithClassAndArguments, e.g.

// print the UI hierarchy.
NSLog(@"%@", ASSendScriptingEventWithClassAndArguments(@"ASUIHierarchy", [NSArray array], NO));

GSEvents

Scripts can also be run with the kGSEventProcessScript event. This event will be sent to the target application's -[UIApplication _processScriptEvent:] method, then call the ASProcessScriptEvent function, and finally report the result to the ApplicationScripting server.