Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
AXUIElementCopyAttributeValue compatibility on tiger (10.4.3)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AXUIElementCopyAttributeValue compatibility on tiger (10.4.3)



Hi All,


My program is trying to save a document and then close it. the logic I
am using with Accessibility APIs is as follows
-	Find file meun
-	Send action command to menu item named "save"
-	Wait while Close is disabled (keep on checking in a loop)
-	Hit close as soon as it is enabled.
In my case application is illustrator 10 and I am saving an eps file
Now the code was working fine with Panther (10.3.9) but switching to
tiger the code break while trying to get kAXTitleAttribute of a menu
item. In following code, exception comes at last line. Plz c the code
and inline comments about output of each API call for both Panther and
Tiger.


	if ((AXUIElementCopyAttributeValue((AXUIElementRef)mMenuBarRef,
	     kAXChildrenAttribute, (CFTypeRef *)&theMenuList) == kAXErrorSuccess) &&
	     (theMenuList != NULL)) {
		   numOfMenus = CFArrayGetCount((CFArrayRef)theMenuList);
		// here I got menu list for both tiger and panther
   for (menuIdx = 0; menuIdx < numOfMenus; menuIdx++) {

 			theMenu = (CFStringRef)CFArrayGetValueAtIndex(theMenuList, menuIdx);
AXUIElementCopyAttributeValue((AXUIElementRef)theMenu, kAXTitleAttribute,
(CFTypeRef *)&menuTitle);

 			if(menuTitle && ((CFStringCompare(menuTitle, CFSTR("File"), 0) ==
kCFCompareEqualTo)
 			  	// this point is also ok for both tiger and panther
 if (AXUIElementCopyAttributeValue((AXUIElementRef)theMenu,
kAXChildrenAttribute,
(CFTypeRef *)&theMenuItems) == kAXErrorSuccess) {

//here I got problem For Panther Children menu items are 11 where
// for Tiger I have only 1

   	 				if (theMenuItems != NULL) {

       		    			CFIndex numOfMenuItems =
CFArrayGetCount((CFArrayRef)theMenuItems);

            				CFIndex menuItemIdx;
            				CFStringRef theMenuItem, menuItemTitle;
							menuItemIdx = 0;
							while (menuItemIdx < numOfMenuItems) {

								// Grab menu
           						theMenuItem =
(CFStringRef)CFArrayGetValueAtIndex(theMenuItems, menuItemIdx);

// second problem at this point; for tiger I don't get kAXErrorSuccess
 in following line of code
		if(AXUIElementCopyAttributeValue((AXUIElementRef)theMenuItem,
kAXTitleAttribute, (CFTypeRef *)&menuItemTitle) == kAXErrorSuccess) {
										.
										.
										.
Regards,
Dave
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.