Skip to content

Instantly share code, notes, and snippets.

@nomeyer
Created February 24, 2016 17:41
Show Gist options
  • Save nomeyer/ff15af2dd9d57818627b to your computer and use it in GitHub Desktop.
Save nomeyer/ff15af2dd9d57818627b to your computer and use it in GitHub Desktop.
If chain to log the outcome (AXError) of an accessibility operation
#include <CoreFoundation/CoreFoundation.h>
AXError rtn = AXUIElementCopyAttributeValue(someApp, someAttribute, (CFTypeRef *)&someRef);
if (rtn == kAXErrorSuccess) {
printf("\nSuccess");
} else if (rtn == kAXErrorInvalidUIElement){
printf("\nInvalid UI Element");
} else if (rtn == kAXErrorIllegalArgument) {
printf("\nIllegal argument");
} else if (rtn == kAXErrorCannotComplete) {
printf("\nCannot complete");
} else if (rtn == kAXErrorAPIDisabled) {
printf("\nAPI disabled");
} else if (rtn == kAXErrorNoValue) {
printf("\nNo value");
} else if (rtn == kAXErrorAttributeUnsupported) {
printf("\nAttribute unsupported");
} else if (rtn == kAXErrorNotImplemented) {
printf("\nNot implemented");
} else {
printf("\nunknown");
}
fflush(stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment