PFApplicationUIElement
IntroductionA concrete class representing the root application UI element of a running application or the system-wide UI element. DiscussionA PFApplicationUIElement object represents the root application UI element of a running application or the system-wide UI element. It is a subclass of PFUIElement and inherits all of PFUIElement's functionality (except that it does not respond to the -PFUIElementWasDestroyed: delegate method). It offers additional features for root-level UI elements (applications and the system-wide UI element). See the PFUIElement class description for more information. Before a client application can make use of this class, the "Enable access for assistive devices" setting in the Universal Access pane of System Preferences must be turned on, or the client application must be made a trusted process through use of the accessibility API's GroupsINITIALIZATIONGroup members:
ELEMENT UTILITIESGroup members:
ACCESSOR METHODSGroup members:
Methods
applicationUIElementWithBundleIdentifier:delegate:Convenience class method creates and returns an initialized PFApplicationUIElement object with + (PFApplicationUIElement *) applicationUIElementWithBundleIdentifier:(NSString *)bundleIdentifier delegate:(id)aDelegate; Parameters
Return ValueAn autoreleased PFApplicationUIElement object, or DiscussionUse this convenience method to create and return an initialized root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also +applicationUIElementWithPath:delegate: , +applicationUIElementWithURL:delegate: , +applicationUIElementWithPid:delegate: and +systemWideUIElementWithDelegate:. applicationUIElementWithPath:delegate:Convenience class method creates and returns an initialized PFApplicationUIElement object with + (PFApplicationUIElement *)applicationUIElementWithPath:(NSString *)fullPath delegate:(id)aDelegate; Parameters
Return ValueAn autoreleased PFApplicationUIElement object, or DiscussionUse this convenience method to create and return an initialized root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also +applicationUIElementWithURL:delegate: , +applicationUIElementWithBundleIdentifier:delegate: , +applicationUIElementWithPid:delegate: and +systemWideUIElementWithDelegate:. applicationUIElementWithPid:delegate:Convenience class method creates and returns an initialized PFApplicationUIElement object with + (PFApplicationUIElement *)applicationUIElementWithPid:(pid_t)pid delegate:(id)aDelegate; Parameters
Return ValueAn autoreleased PFApplicationUIElement object, or DiscussionUse this convenience method to create and return an initialized root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also +applicationUIElementWithPath:delegate: , +applicationUIElementWithURL:delegate: , +applicationUIElementWithBundleIdentifier:delegate: and +systemWideUIElementWithDelegate:. applicationUIElementWithURL:delegate:Convenience class method creates and returns an initialized PFApplicationUIElement object with + (PFApplicationUIElement *)applicationUIElementWithURL:(NSURL *)url delegate:(id)aDelegate; Parameters
Return ValueAn autoreleased PFApplicationUIElement object, or DiscussionUse this convenience method to create and return an initialized root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also +applicationUIElementWithPath:delegate: , +applicationUIElementWithBundleIdentifier:delegate: , +applicationUIElementWithPid:delegate: and +systemWideUIElementWithDelegate:. elementAtPoint:Creates and returns a PFUIElement object representing the visible UI element located at - (PFUIElement *)elementAtPoint:(NSPoint)point; ParametersReturn ValueThe PFUIElement object at DiscussionUse this method to read the screen, based, for example, on the current location of the mouse. Use the PFUIElement class method +elementAtPoint:withDelegate:error: instead of this instance method to get a PFUIElement object representing the UI element located at See PFUIElement's -initWithElementRef:delegate:: method for important information. initSystemWideWithDelegate:The designated initializer for the PFApplicationUIElement class for a system-wide element. - (PFApplicationUIElement *)initSystemWideWithDelegate:(id)delegate; Parameters
Return ValueA system-wide PFApplicationUIElement object. DiscussionInitializes and returns a newly allocated system-wide PFApplicationUIElement object. Use this designated initializer to initialize a newly-allocated root UI element object for the entire system, representing all running applications collectively. Use this method, for example, to obtain the element currently having systemwide focus without first determining which application is active. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: method for important information. See also -initWithPath:delegate: , -initWithURL:delegate: , -initWithBundleIdentifier:delegate: and -initWithPid:delegate:. initWithBundleIdentifier:delegate:Initializes and returns a newly allocated PFApplicationUIElement object with - (PFApplicationUIElement *)initWithBundleIdentifier:(NSString *)bundleIdentifier delegate:(id)aDelegate; Parameters
Return ValueA PFApplicationUIElement object, or DiscussionUse this convenience initializer to initialize a newly-allocated root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also -initWithPath:delegate: , -initWithURL:delegate: , -initWithPid:delegate: and -initSystemWideWithDelegate:. initWithPath:delegate:Initializes and returns a newly allocated PFApplicationUIElement object with - (PFApplicationUIElement *)initWithPath:(NSString *)fullPath delegate:(id)aDelegate; Parameters
Return ValueA PFApplicationUIElement object, or DiscussionUse this convenience initializer to initialize a newly-allocated root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also -initWithURL:delegate: , -initWithBundleIdentifier:delegate: , -initWithPid:delegate: and -initSystemWideWithDelegate:. initWithPid:delegate:The designated initializer for the PFApplicationUIElement class for a specific application. - (PFApplicationUIElement *)initWithPid:(pid_t)pid delegate:(id)aDelegate; Parameters
Return ValueA PFApplicationUIElement object whose UNIX process identifier is pid. DiscussionInitializes and returns a newly allocated PFApplicationUIElement object with Use this designated initializer to initialize a newly-allocated root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also -initWithPath:delegate: , -initWithURL:delegate: , -initWithBundleIdentifier:delegate: and -initSystemWideWithDelegate:. initWithURL:delegate:Initializes and returns a newly allocated PFApplicationUIElement object with - (PFApplicationUIElement *)initWithURL:(NSURL *)url delegate:(id)aDelegate; Parameters
Return ValueA PFApplicationUIElement object, or DiscussionUse this convenience initializer to initialize a newly-allocated root UI element object for a specific application; for example, to browse a specific application's user interface without regard to whether it is frontmost or where on the screen its UI elements may be located. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also -initWithPath:delegate: , -initWithBundleIdentifier:delegate: , -initWithPid:delegate: and -initSystemWideWithDelegate:. pidNumberReturns the BSD Unix process identification number (PID) of the receiver. - (NSNumber *)pidNumber; Return ValueAn NSNumber object encoding an integer value. DiscussionIt is sometimes useful to know the process identification number of an application. For example, it can be used with a variety of Carbon functions to access information not otherwise readily available in Cocoa. See also the -pid method in the PFUIElement class, which returns the PID as an integer. Use NSNumber's systemWideUIElementWithDelegate:Convenience class method creates and returns an initialized system-wide PFApplicationUIElement object. + (PFApplicationUIElement *)systemWideUIElementWithDelegate:(id)aDelegate; Parameters
Return ValueAn autoreleased system-wide PFApplicationUIElement object. DiscussionUse this convenience method to create and return an initialized UI element object for the entire system, representing all running applications collectively. Use this method, for example, to obtain the element currently having systemwide focus without first determining which application is active. A PFApplicationUIElement object does not participate in PFUIElement's delegate and notification mechanisms regarding destroyed UI elements. It does not report when it is destroyed (that is, when the application quits). See the -PFUIElementWasDestroyed: delegate method and PFUIElement's -elementInfo for details regarding these mechanisms. See PFUIElement's -initWithElementRef:delegate: for important information. See also +applicationUIElementWithPath:delegate: , +applicationUIElementWithURL:delegate: , +applicationUIElementWithBundleIdentifier:delegate: and +applicationUIElementWithPid:delegate:. typeCharacters:keyCode:withModifierFlags:Posts keyboard events to the application represented by the receiver, whether or not it is the active application. - (void)typeCharacters:(NSString *)characters keyCode:(unsigned short)virtualKey withModifierFlags:(NSUInteger)flags; Parameters
DiscussionUse this method to type one character at a time into the UI element that currently has keyboard focus in the application represented by the receiver (usually a text-based view or control such as a text view or a text field). Specifying the Command key in Use -typeCharactersSystemWide:keyCode:withModifierFlags: instead of this method to type characters into the active application without first determining which application is active. The On Roman systems, the typeCharactersSystemWide:keyCode:withModifierFlags:Class method posts keyboard events to the active application. + (void)typeCharactersSystemWide:(NSString *)characters keyCode:(unsigned short)virtualKey withModifierFlags:(NSUInteger)flags; Parameters
DiscussionUse this method to type one character at a time into the UI element that currently has keyboard focus in the active application (usually a text-based view or control such as a text view or a text field). Specifying the Command key in flags may be treated by the application as a keyboard shortcut for a menu item or button. Use -typeCharacters:keyCode:withModifierFlags: instead of this method to type characters into a specific application whether or not it is active. The On Roman systems, the |