Using applescript, how to move a window to my second display?

It looks like Apple have set the window to be aware of what Display it should be on and not extend outside of thats Displays bounds when launching.

A side effect of this is the App will do the same thing with the calls from the applescript.

You can see this if you straddle the window across both Displays. Then quit and relaunch the app.

The window will open on only one of the displays and not be straddled.

If you did the same for say Safari. The window you had straddling would still be straddling.

I think you are out of luck doing it in any way useful.

The only way I got it to do it was to get the window and display details from the plist file '~/Library/Preferences/com.apple.FaceTime' while the window was on the second display.

 (* read plist file *)
    do shell script "/usr/bin/defaults read ~/Library/Preferences/com.apple.FaceTime NSWindow\\ Frame\\ FaceTimeWindowFrame"

Then when the app was on the first display.

Run a script which quit the app, rewrites the 'NSWindow Frame FaceTimeWindowFrame' entry in the plist with the info for the position and display I had from earlier.

Activate the app again, which would open on the second display. And then move it with the normal applescript code.

tell application "FaceTime" to quit
(do shell script "/usr/bin/defaults write ~/Library/Preferences/com.apple.FaceTime NSWindow\\ Frame\\ FaceTimeWindowFrame" & (" '2562 853 638 585 2560 240 1920 1200'") as string) --set to somewhere on my second screen

delay 1
tell application "System Events"

    tell application "FaceTime" to activate

    delay 4
    set position of window "FaceTime" of application process "FaceTime" to {3269, 315}

    end tell

But like I said not very useful. :-(


While this does not directly answer the question of using applescript, it may be a valid answer for the actual issue of moving windows.

You can use a small third party application like Slate.

With minor configuration it can be set to move the window by title when Slate launches, when a key is pressed, or when a condition is met.

It can also be configured to move any window to a specific position when a key is pressed or a condition is met.

Slate may fit the request because it's footprint is extremely small, and it does not require administration privileges.

A good introduction:

http://mauriciogardini.com/post/43348489262/slate-a-mac-os-x-window-manager-for-power-users


There is now (from Catalina? onwards) a menu command in the Window menu to move the current window to another display.

So you could do it with GUI scripting.

enter image description here