7

I have a Quicktime window, and I would like to have it positioned at exactly (533,118). I have (painfully) achieved this using the Macbook's screenshot functionality (because it shows the coordinates of the cursor, so with a couple tries it can be done).

I know that windows normally remember their last position, but sometimes I need to move them to another location. It would be great if I could just input the desired coordinates.

I'm using macOS 10.13.

11

Here's an example AppleScript that sets the position of window 1 of Quick Time Player to {533, 118}, if it's running and the window exists.

if application "QuickTime Player" is running then
    try
        if (count windows of application "QuickTime Player") is greater than 0 then
            tell application "System Events" to set position of window 1 of application process "QuickTime Player" to {533, 118}
        end if
    end try
end if

This can be saved as a script or application or incorporated into an Automator workflow as a Service and assigned a keyboard shortcut, if you prefer.

Here's an example AppleScript that you can enter the {x, y} position info as a space separated value in a display dialog box:

if application "QuickTime Player" is running then
    try
        if (count windows of application "QuickTime Player") is greater than 0 then
            tell application "QuickTime Player"
                set theReply to (display dialog "Move window to position, e.g.: 533 118" default answer "533 118" buttons {"Cancel", "OK"} default button 2 with title "Enter Windows X Y Coordinates")
            end tell
            tell application "System Events" to set position of window 1 of application process "QuickTime Player" to {word 1 of text returned of theReply as integer, word 2 of text returned of theReply as integer}
        end if
    end try
end if

Note that you can set default answer "533 118" to default answer "", if you don't want a default value set.

enter image description here

5

The two window manager tools I'd use for this are Moom and Divvy - both offer demo versions so you can try before you buy.

Once you have an automated move/tile/manage tool, you'll start doing this sort of automated management more and more.

I suppose if you wanted to learn AppleScript - that also might have all the hooks you need to resize the windows. Open script editor and you can see the details that the window class allows you to script.

enter image description here

  • 1
    Where is that Applescript documentation (last image)? How do I get there? – Laurel Oct 30 '17 at 3:49
  • 2
    @Laurel, In Script Editor, press ⇧⌘L or from the menu bar, click: Script Editor > Window > Library and you can see in the title of the above window that System Events is selected to be viewed and then "window" is the search term within System Events. – user3439894 Oct 30 '17 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .