Problem with AXPosition
Hi, Why the "AXPosition" doesn't return a window position in another workspace like "AXSize"? Someone already had this problem? AXUIElementCopyAttributeValue(element, (CFStringRef)@"AXPosition", &thePosition); AXUIElementCopyAttributeValue(element, (CFStringRef)@"AXSize", &theSize); Thanks! -- Atenciosamente, Diego Alvarez Nogueira Blog: http://diegonogueira.com.br | http://papoinformal.com Skype: nogueiradiego Twitter: @nogueiradiego ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How can i change a app position and size?
Thank you, But i have one more doubt: How can i get the WindowID(window number) using AXUIElementRef? There is a way to get this? AXUIElementRef element = AXUIElementCreateApplication(pid); Thanks! On 27/07/2011, at 13:30, David Duncan wrote: > On Jul 26, 2011, at 6:14 PM, Diego Alvarez Nogueira wrote: > >> 1)Why do I have some differences in get bounds between cocoa and >> applescript? for instance: on 'originString' and 'sizeString' are >> returned({1920,106,1280,800}) and with applescript ("set _bounds to get >> bounds of window window_number") are returned ({1920, 106, 3200, 906}). > > > This is probably a holdover from the classic Mac OS days when rectangles were > described as left/top/right/bottom. Core Graphics describes rectangles as > left/top/width/height instead, which is what you are seeing from the CGWindow > API. > -- > David Duncan > -- Atenciosamente, Diego Alvarez Nogueira Blog: http://diegonogueira.com.br | http://papoinformal.com Skype: nogueiradiego Twitter: @nogueiradiego ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How can i change a app position and size?
Sorry, i am new in cocoa, i've searched a lot about how can i do this. I'm capturing the bounds in this way: === CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID); for (NSMutableDictionary* entry in (NSArray*) windowList) { NSString *appPID = [entry objectForKey:(id)kCGWindowOwnerPID]; NSString *appName = [entry objectForKey:(id)kCGWindowOwnerName]; NSString *appWorkSpace= [entry objectForKey:(id)kCGWindowWorkspace]; NSString *appWindowID = [entry objectForKey:(id)kCGWindowNumber]; CGRect bounds; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[entry objectForKey:(id)kCGWindowBounds], &bounds); NSString *originString = [NSString stringWithFormat:@"%.0f/%.0f", bounds.origin.x, bounds.origin.y]; [entry setObject:originString forKey:@"windowOrigin"]; NSString *sizeString = [NSString stringWithFormat:@"%.0f*%.0f", bounds.size.width, bounds.size.height]; [entry setObject:sizeString forKey:@"windowSize"]; } 1)Why do I have some differences in get bounds between cocoa and applescript? for instance: on 'originString' and 'sizeString' are returned({1920,106,1280,800}) and with applescript ("set _bounds to get bounds of window window_number") are returned ({1920, 106, 3200, 906}). 2) How can i apply this bounds with cocoa? for instance, move and resize my safari and terminal application. Thanks a lot! Best, Diego Nogueira On 26/07/2011, at 06:28, Bill Cheeseman wrote: > > On Jul 26, 2011, at 1:02 AM, Jens Alfke wrote: > >> On Jul 24, 2011, at 4:14 PM, Diego Alvarez Nogueira wrote: >> >>> How can i change a app position and size by Pid number? >> >> You mean resizing other apps’ windows? I think the only option is using UI >> Scripting, where you can send an app AppleEvents that generate fake user >> input events like clicks and drags. Look it up in the developer >> documentation. > > > Or use Apple's accessibility API directly. GUI Scripting is built on top of > the accessibility API. > > -- > > Bill Cheeseman - b...@cheeseman.name > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/diegoalvareznogueira%40gmail.com > > This email sent to diegoalvareznogue...@gmail.com -- Atenciosamente, Diego Alvarez Nogueira Blog: http://diegonogueira.com.br | http://papoinformal.com Skype: nogueiradiego Twitter: @nogueiradiego ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How can i change a app position and size?
Hi everyone, How can i change a app position and size by Pid number? thanks, Cheers, Diego Nogueira -- Atenciosamente, Diego Alvarez Nogueira Blog: http://diegonogueira.com.br | http://papoinformal.com Skype: nogueiradiego Twitter: @nogueiradiego ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com