XCode is opening Windows at arbitrary Positions, since one of the last Updates.
Is it possible to center XCode Windows?
I don't know the Window-Name of the Windows.
There's the Manipulate a Window
action which has the option to centre the front window in either the front application, or a named application. Perhaps that would work:
Alternatively, you could try and retrieve the name of the front window through a quick bit of AppleScript, then use that name to target it with Keyboard Maestro:
tell application "System Events" to ¬tell application process "XCode" to ¬get the name of the front window
Thank you very much.
That is working.
Xcode is scriptable, so there's no need to turn to System Events – unless you specifically want to deal with window size and position instead of bounds:
tell application "Xcode"
tell front window
set frontWindowBounds to bounds
set frontWindowName to name
end tell
end tell
-Chris
Thanks, @ccstone. I didn't know this and for some reason simply assumed it wouldn't be, where the sensible thing to do would have been to outline both situations. Your use of its scriptability is undoubtedly the more recommended approach here.
Where can I find Information about Xcodes Scripting-Interface?
I could not find anything, yet.
What sort of information ? Regarding AppleScriptability and its implementation, my typical method is to open Script Editor and bring up the "Library" window by pressing ⇧⌘L; after locating the XCode app icon (e.g. by opening the "Applications" folder in Finder), you can then drag the app onto Script Editor's "Library" window, and it should be added to the list given that it's scriptable.
From there, just double click on it, and Script Editor will show you the AppleScript dictionary for XCode, containing all (most) of its terminology and syntax, together with object inheritance. These dictionaries are fairly poorly structured, but also indispensable for formulating code targeted at an application that you've not scripted in the past.
Script Debugger, if you have it, has a builtin dictionary that is much more comprehensive it seems, and gives the feeling of being easier to read, plus, as far as I can tell, negates the need to add an application to its list manually, which one needs to do with Script Editor before you can access the dictionary.
Hey Tom,
The simplest way is to drag Xcode onto the Script Editor.app in the Finder or Dock.
@CJK's method is a bit handier for repeated use, although I usually use LaunchBar for this sort of task.
@CJK is also right about Script Debugger being a far superior means to read an app's scripting dictionary. (Even the free lite version.)
-Chris