Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have experimented with absolutely every possible scripting option I can find on the web, and no matter what I do I cannot move a FaceTime window to my secondary display.

This works...

tell application "System Events" to tell process "FaceTime"
  tell application "FaceTime" to activate
  tell front window to set position to {3600, 500}
end tell

but with one fatal flaw that it always stops dead in its tracks, at the right edge of display #1 (the left display).

If I set the X coordinate to anything less than 2560 (my width on both screens) then it works perfectly, but any attempt to move it further to the right, and thus onto display #2, will not work.

I don't know if it's related, but my primary display is an external Dell, and my secondary display is the built-in display of the 27" iMac. Dell on the left, iMac on the right.

Interestingly however, if I manually drag the window onto display #2 and run the same script above, then it positions correctly onto display #2. It seems that the numbers are relative to whatever display the window is CURRENTLY on. How can I get it to absolutely position the window onto display #2?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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. :-(

share|improve this answer
    
WOW... that is some brute force all right. Thank you for the effort, but you're right... not terribly useful. What a shocking bummer! =( –  Jonathan van Clute Oct 7 '12 at 16:37

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

share|improve this answer
    
Very cool alternative, thanks! I wasn't married to using AppleScript, it was just the only approach I could think of. I'll give this one a shot the next time I want to do this. –  Jonathan van Clute Oct 8 '13 at 22:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.