



Now, use a text editor like Notepad++ to help you edit the XML. Another issue is that any HTML output window that has not completed will prompt on whether to stop its task, and the tooltip will appear even though there might still be windows-with-prompts around.I prefer Notepad++ but there are tons out there. I loop backwards since closing a window shifts higher indices down.Īs a comment in the code mentions, there is an occasional off-by-one bug in the "Closed 123 HTML output windows" tooltip message. So I loop over the windows by index, doing GUI scripting by window index in process land and closing windows by index in tell application land. To use the GUI scripting (to detect AxWebAreas), one apparently has to talk to the app as a System Events process – which seems to disallow anything like close theWindow. It was a bit tricky to actually close the window. Return "Closed " &closedCount & " HTML output windows." Return "No HTML output windows to close." FIXME: This count is sometimes the expected value + 1 - why?

Tell application "TextMate" to close window i Tell the first UI element of the first scroll area of window i Repeat with i from (count windows ) to 1 by - 1 - iterate backwards so indices don't shift on close Tell application "TextMate" to set answer to button returned of (display dialog "This command relies on the GUI scripting architecture of Mac OS X which is currently disabled." & return & return & "You can activate it by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." buttons default button 1 with icon 1 ) The command is a shell script that wraps this piece of AppleScript: set closedCount to 0 This is very useful, at least to me, when developing some TextMate commands – one can end up with tons of such windows. I wrote a TextMate command to close all HTML output windows: Close All HTML Output Windows.tmCommand.
