Applescript make tall windows without autoresizing?

Yos,


I have a PowerMac hooked up to 6 projector displays, making one giant desktop on my lab wall made out of 6 screens, arranged 3 across and 2 high. The individual displays are 1280x800.


I am writing Applescript code to open a bunch of Safari windows and lay them randomly around this giant, awesomely awesome screen. This is fairly easy just by opening a URL and setting the bounds of the window. Applescript seems to recognize the whole thing as a single coordinate system 3840x1600 in size when I set the window bounds.


There is one problem I can't get around, however: if I ever try to create a window taller than 800 pixels, it gets snapped to 800 pixels and the window position is snapped to the top of a single screen. I have no problems making very wide windows just by setting the bounds eg {10, 10, 3010, 610}. But if I try {10, 10, 610, 1210} it will snap the bounds to {0, 0, 600, 800}.


I also have this problem when using the mouse. I can stretch a window really tall, but if I try to move it, it will snap to the top half of my display. It is not a Safari issue, but a problem with pretty much any application. Is there any way to disable this feature, or otherwise get Applescript to make a window tall without the UI saying "oh no you don't"?


Thanks!

Posted on Jan 27, 2012 9:10 AM

Reply
7 replies

Jan 27, 2012 9:30 AM in response to xcottcraver

Can you post your code?


It does seem that Safari doesn't like to size windows larger than the screen, and it's possible that it's getting confused by the multi-monitor setup, but in general I've never had a problem resizing windows to any size or position, including almost entirely offscreen in most apps (Safari does seem to be different here).

Jan 27, 2012 9:45 AM in response to Camelot

I just run the a set bounds command with /usr/bin/osascript, from the command line:


tell application "Safari"

set bounds of the first window to {10, 10, 610, 1210}

end tell


That's it. Also, I get the same problem when using the mouse. I will take a window (Safari or Firefox or Preview or whatever,) stretch it taller than 800 pixels, and then it snaps to one screen when I try to move it. I have no problems making windows very wide. It only seems to be in the case of tall windows that applications snap themselves.


Apple sells this 6-monitor (2 video card) setup specifically for Displaywall applications, so I'm thinking there must be some way around this behavior---otherwise, you couldn't do things like make a window full-screen across the entire displaywall.

Jan 27, 2012 12:32 PM in response to xcottcraver

Just to add, I tried the same thing with Firefox, Google Chrome, and Preview. None of them allow me to make the window taller than half the display (e.g., taller than a single screen in height.)


I also opened an empty Cocoa App project in Xcode, built and ran it, and observed that stretching and moving the window with my mouse caused it to snap back in the same way. So this isn't really a Safari thing, but seems to be fairly universal behavior.

Jan 27, 2012 1:36 PM in response to xcottcraver

Unfortunately, you are running into a limitation of apple's Human Interface Guideline, which wants to keep titlebar controls from appearing off-screen where users cannot get access to them. I'm pretty sure this is built into the Window Manger itself, so (at least for your main monitor - the one with the menu bar) you're not going to be able to do this.

Jan 27, 2012 2:02 PM in response to twtwtw

Hi,


Thanks for your explanation, but I suspect there must be a way to resize a window across two displays stacked vertically.


After all, I am able to stretch a window across the entire display wall with my mouse. It only snaps back if I try to move the window later. I figure that if I can do this with my mouse, there must be a way to do the same thing with AppleScript.


Plus, you have the fact that Apple sells this thing with 2 video cards to drive 6 displays for exactly this purpose, making display walls.

Jan 28, 2012 7:53 AM in response to xcottcraver

Hi again,


I found an ugly hackish way to resize windows across the monitors without snapback. Because you can do this with the mouse, I found some (non-Applescript) code to trigger mouse click and drag events, and wrote a program to move the mouse over the window's resize widget and drag it where I want.


So it can be done, albeit in a very roundabout way. I'd rather do it all in Applescript, but in the UI scripting I could only find commands to click and select things, not drag anything.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Applescript make tall windows without autoresizing?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.