Reposition an application's floating windows (inspector, palette, etc)

Hi all

Dabbling with AppleScript to automate the repositioning of the floating windows in OmniGraffle (a design tool). The following doesn’t detect the windows in question:

set wins to every window of application "OmniGraffle Professional 5"
set c to count wins
-- display dialog (c as string)
repeat with w in wins
	display dialog ((name of w) as string)
end repeat

I don’t know whether the windows in question are classed as “windows” though. Is there something else I should use, or are they simply unscriptable?

Thanks in advance!

Hello, they are pretty unscriptable, and unavailable, first of all the process name, you need with System Events, which deals with behind the scenes tasks, with regard to UIScripting, (in cooperation with UIElementInspector).

I had to look up the process name with Activity Monitor, and I had a look with UIElement inspector, the only query I made to works was the one below, and it is kind of natural, since this app, is so tied up to fine gestures and the like, that they haven’t invested too much in UI scriptability.

The query below worked for me, this returns several window, all with a window id of -1, I haven’t tried to do fun things as skewing it to the rightside or such, since I think such behaviour is pretty unavailable with a window id of -1, so I leave it up to you to decide whether to invest time in it or not.

I just move it, and click the stencils icon, or inspector icon I have on the toolbar to make them go away.

tell application id "com.omnigroup.OmniGrafflePro"
	set a to every window of it whose name is "Window"
	repeat with i in a
		tell i to properties
	end repeat
end tell

By the way, I have really loved to use Omni Graffle from the day, I started to use canvas sizes the double of what I need, (A3 instead of A4), and then just reducing the end product with 50% before printing. :wink:

Thanks for your response. Looks like it’ll have to remain a dream :slight_smile:


I tried to use some of UIScripting, for reading properties, and it didn’t play out well. Even the application process name is done hard to get. (The guys that makes OmniGraffle and the other Omni products, are reckoned to be among the very best Cocoa programmers there is, so there is no accident, that they have configured the app like that.) So I figure that setting any UI Element attributes is even worser, A window with an id of -1, is pretty much inaccessible by the id anyway, so, I didn’t put time into it, as I have very low hopes for coming up with something that works. Sorry about that.

Of course I just jumped onto this problem, because I have dreamt of that feature too. :slight_smile:


I investigated the user interface a little further. :slight_smile: I can save a workspace configuration in the window menu. Those configurations of the windows, and pallettes open then gets their position recorded, and assigned to a function key.
So now I press “F2” to get the palette to the far right. :slight_smile:

Oh my word. You are a genius!!! :smiley:

Only motivated, for resovling that issue, because it actually has started to nag me as well as of lately.

Many good programs do have ways of remembering the window state, so I just started to look for it.

Ok, so I tried hard to make whatever I had written above to be a lie, because I really want to have a cure all for moving the floating windows of OmniGraffle aside.

But what do you know, the floating windows, have a floating point index value, (that value, becomes coerced to an integer value when I pull it out with the index property, and that value doesn’t match the real index of the window when I tried to address the window by its index. :slight_smile:


I am not complaining over this behaviour really, because this means that it operates much better with regular window handling scripts. That is really a pro!