Programatically resize reposition applications

Discussion in 'Mac Programming' started by IDMah, Aug 7, 2011.

  1. IDMah macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #1
    Hi all.

    It there a way to programatically record resize and reposition application windows.

    Not my application but other application .. ie. safari, mail

    I'd like to be able to create environments. say Mail Full length on the left and Safari on the right .. but then be able to switch to Safari on the top mail and something else on the bottom...

    I'd also like it to launch these programs as well ...

    thanks
    Ian

    ps. If there is something already out there that does this then please please let me know.. spending too much time moving window around..
     
  2. GorillaPaws macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #2
  3. res1233, Aug 11, 2011
    Last edited: Aug 11, 2011

    res1233 macrumors 65816

    res1233

    Joined:
    Dec 8, 2008
    Location:
    Brooklyn, NY
    #3
    Here's some AppleScript:

    Code:
    tell application "Safari" to get bounds of window 1
    
    Code:
    tell application "Safari" to set bounds of window 1 to {20,20,500,500}
    
    The first script gets the position of the window, top left corner then bottom right corner {x,y,x,y}. The second script sets those values.

    You can replace "window 1" with "window 'name'", replacing name with the name of the window, for a little more precision.

    If you'd like to scale those values based on the resolution being used (ideal) use this script to get the resolution:

    Code:
    tell application "Finder" to get bounds of window of desktop
    If you have no idea how to use Applescript, I could write it for you, just ask. ;) I enjoy this stuff.
     
  4. IDMah thread starter macrumors 6502

    IDMah

    Joined:
    May 13, 2011
    #4
    thanks

    That's awesome, I knew it was in there somewhere. Just too stupid
    to find it..

    Hopefully I'll find time to bash together the project I'm thinking of and Send
    you a copy when it's done.

    just tired of moving window all day..

    thanks
    Ian
     

Share This Page