Permalink
Browse files

added a method to log all of an element's AX attribute names

  • Loading branch information...
1 parent 4a632d5 commit c7d8c200838a759cc270c594a9b0f7c15f1d1537 @joshaber committed Jul 23, 2011
Showing with 11 additions and 4 deletions.
  1. +2 −4 Additions/AX/KIFApplication.m
  2. +2 −0 Additions/AX/KIFElement-Private.h
  3. +7 −0 Additions/AX/KIFElement-Private.m
View
6 Additions/AX/KIFApplication.m
@@ -33,6 +33,8 @@ + (KIFApplication *)applicationWithCurrentApplication {
+ (KIFApplication *)applicationWithBundleIdentifier:(NSString *)bundleIdentifier {
NSArray *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleIdentifier];
+ NSAssert1(apps.count > 0, @"We couldn't find any apps with the bundle identifier: %@", bundleIdentifier);
+
if(apps.count > 1) {
NSLog(@"Whoa, we found multiple running apps with that bundle ID: %@. We're just going to use the last one.", apps);
}
@@ -47,10 +49,6 @@ - (id)initWithPID:(pid_t)pid {
if(self == nil) return nil;
- CFArrayRef names;
- AXUIElementCopyAttributeNames(appRef, &names);
- NSLog(@"%@", names);
-
return self;
}
View
2 Additions/AX/KIFElement-Private.h
@@ -13,4 +13,6 @@
- (CFTypeRef)attributeForKey:(NSString *)key;
- (id)wrappedAttributeForKey:(NSString *)key;
+- (void)logAllAttributes;
+
@end
View
7 Additions/AX/KIFElement-Private.m
@@ -37,4 +37,11 @@ - (id)wrappedAttributeForKey:(NSString *)key {
}
}
+- (void)logAllAttributes {
+ CFArrayRef names = NULL;
+ AXUIElementCopyAttributeNames(self.elementRef, &names);
+ NSLog(@"%@", names);
+ CFRelease(names);
+}
+
@end

0 comments on commit c7d8c20

Please sign in to comment.