Change position of another app's window

Discussion in 'Mac Programming' started by vadym.hulakov, Oct 22, 2010.

  1. vadym.hulakov
    Expand Collapse
    macrumors newbie

    Joined:
    Oct 22, 2010
    #1
    I am using python and pyobjc. I need to change position of another app's window.

    Information I have is title of window. Also I can get window number by using Quartz.CGWindowListCopyWindowInfo().
     
  2. ulbador
    Expand Collapse
    macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #2
    As the "quick and dirty way", I would probably just call a shell script. You just would execute the command "osascript". You can make osascript tell the application or even the Finder to close or move windows.
     
  3. vadym.hulakov
    Expand Collapse
    thread starter macrumors newbie

    Joined:
    Oct 22, 2010
    #3
    I think that "quick and dirty way" is ok for this case. But I have problems with osascript. I use command:

    osascript -e 'tell application "FooApp" set bounds of window 1 to {100, 100, 500, 500}'

    I get error "execution error: FooApp got an error: Can't set bounds of window 1 to {100, 100, 500, 500}. (-10006).

    Interesting that this command work fine for TextEdit

    osascript -e 'tell application "TextEdit" set bounds of window 1 to {100, 100, 500, 500}'

    What do I need to do make my application compatible with osascript?
     

Share This Page