Reputation: 3919
I'd like to be able to select (with the mouse), some window that's visible on the screen, store it's size. I also want to be able to modify the size of some window that's visible on the screen. The window is not a window within my own app.
How can I do this in Cocoa?
Upvotes: 2
Views: 466
Reputation: 61228
You can use the Accessibility API to control other apps' windows (and more).
Upvotes: 1
Reputation: 11113
I don't know how you can interface with windows in other applications. You would probably have to do something with Apple Script which can be run from Cocoa. As far as in your own app you can look at the documentation for NSWindow at Apples Site. You can get the window size with the frame property like [window frame]
and save that either in mememory as an NSRect or if you need to save it in a file with NSNumbers or NSData. You can then resize a window by setting its frame property. with [window setFrame:]
good luck hopefully this well get you in the right direction!
Upvotes: 0