Search code examples
macoswindowapplescript

Move a window to top left corner


I'm trying to move a window to the top left corner of my screen.

This is what I've written:

tell application "System Events"
    tell application process "appIT"
        tell window 1
            --Move lobby to left corner
            set s to size
            activate
            set the bounds to {40, 40, item 1 of s, item 2 of s}
        end tell
    end tell
end tell

But when I run the script I'm getting this error:

System Events found an error: I can't set bounds of window 1 of application process "appIT" to {40, 40, 1037, 696}

What am I doing wrong?


Solution

  • I got it working:

    tell window 1
        activate
        set position to {0, 20}
    end tell