The GDAccessibilityOperationResult is a result object from an accessibility operation performed by the GDAccessibilityManager. More...
#import <GDAccessibilityOperationResult.h>
Public Member Functions | |
| (Boolean) | - wasSuccess |
| Whether or not the operation was successful. | |
| (Boolean) | - wasSystemFailure |
| Checks result code against kAXErrorFailure. | |
| (Boolean) | - hadIllegalArgument |
| Checks result code agains kAXErrorIllegalArgument. | |
| (Boolean) | - wasInvalidAXUIElementRef |
| Checks result code against kAXErrorInvalidUIElement. | |
| (Boolean) | - wasInvalidAXObserverRef |
| Checks result code against kAXErrorInvalidUIElementObserver. | |
| (Boolean) | - wasUnsupportedAttribute |
| Checks result code against kAXErrorAttributeUnsupported. | |
| (Boolean) | - wasUnsupportedAction |
| Checks result code against kAXErrorActionUnsupported. | |
| (Boolean) | - wasUnsupportedNotification |
| Checks result code against kAXErrorNotificationUnsupported. | |
| (Boolean) | - wasNotImplemented |
| Checks result code against kAXErrorNotImplemented. | |
| (Boolean) | - wasNotificationAlreadyRegistered |
| Checks result code against kAXErrorNotificationAlreadyRegistered. | |
| (Boolean) | - didMessagingFail |
| Checks result code against kAXErrorCannotComplete. | |
| (Boolean) | - notificationWasntRegistered |
| Checks result code against kAXErrorNotificationNotRegistered. | |
| (Boolean) | - apiIsDisabled |
| Checks result code against kAXErrorAPIDisabled. | |
| (Boolean) | - wasIncorrectValue |
| Checks result code against kAXErrorNoValue and kAMIncorrectValue. | |
| (Boolean) | - wasUnsupportedParameterizedAttributes |
| Checks result code against kAXErrorParameterizedAttributeUnsupported. | |
| (Boolean) | - wasIncorrectRole |
| Checks result code against kAMIncorrectRole. | |
| (Boolean) | - wasAttributeNotSettable |
| Checks result code against kAMAttributeNotSettable. | |
| (Boolean) | - wasErrorSettingValue |
| Checks result code agains kAMCouldNotSaveValue - this will occur if AXValueCreate fails. | |
| (Boolean) | - isResultAXUIElementRef |
| Check if the result is an AXUIElementRef. | |
| (Boolean) | - isResultCGPoint |
| Check if the result is a CGPoint type. | |
| (Boolean) | - isResultCGRect |
| Check if the result is a CGRect type. | |
| (Boolean) | - isResultCFRange |
| Check if the result is a CFRange type. | |
| (Boolean) | - isResultCGSize |
| Check if the value is a CGSize type. | |
| (Boolean) | - isResultObserverRef |
| Check if the result is an AXObserverRef. | |
| (NSPoint) | - resultAsNSPoint |
| Returns the result as an NSPoint, you should first check that the result was a CGPoint ([res isResultCGPoint]). | |
| (NSRect) | - resultAsNSRect |
| Returns the result as an NSRect, you should first check that the result was a CGRect ([res isResultCGRect]). | |
| (NSSize) | - resultAsNSSize |
| Returns the result as an NSSize, you should first check that the result was a CGSize ([res isResultCGSize]). | |
| (NSRange) | - resultAsNSRange |
| Returns the result as an NSRange, you should first check that the result was a CGRange ([res isResultCGRange]). | |
| (NSString *) | - resultAsNSString |
| Returns the result as an NSString. | |
| (NSValue *) | - resultAsNSValue |
| Return the result as an NSValue or NULL. | |
| (CFTypeRef) | - result |
| The raw result from the operation. | |
| (void) | - setResult: |
| Set the result. | |
Protected Attributes | |
| CFTypeRef | result |
| The raw CFTypeRef result from an accessibility operation. | |
Properties | |
| NSInteger | resultCode |
| The result code of the operation. | |
The GDAccessibilityOperationResult is a result object from an accessibility operation performed by the GDAccessibilityManager.
You should always check the "wasSuccess" method before accessing the result. The result property will be NULL if there was an error which will cause your program to crash if you access it.
If the result wasn't a success, you can use various methods to find the error. As an example: "wasInvalidAXUIElementRef".
Additionally, there are a bunch of helpers to get the result as a certain type, such as an NSRect, NSSize, etc. The raw result is accessable by the "result" property.
Here's an extracted example of how you use this:
accessManager = [GDAccessibilityManager sharedInstance]; topApp = [[workspace activeApplication] retain]; topApplicationName = [topApp valueForKey:@"NSApplicationName"]; pid_t appid = (pid_t)[[topApp valueForKey:@"NSApplicationProcessIdentifier"] intValue]; AXUIElementRef application; AXUIElementRef window; GDAccessibilityOperationResult * windowres; GDAccessibilityOperationResult * pidres = [accessManager applicationRefFromPid:appid]; if([pidres wasSuccess]) { application = (AXUIElementRef)[pidres result]; windowres = [accessManager focusedWindowForApplication:application]; if([windowres wasSuccess]) { window = (AXUIElementRef)[windowres result]; } }
| - (void) setResult: | (CFTypeRef) | reslt |
Set the result.
| reslt | The raw CFTypeRef that is the accessibility operation result. |