I think it is confusing to provide such detail for things that don’t work.
####So, let me see if I now have it straight about what CAN be done:
The only change in the stack of windows that can be made, is to make a selected window as frontmost.
You could do this by telling AppleScript to set the index of a window to 1
When you move a window to the front, all of the other windows remain in the order that they were.
####However, with a simple AppleScript, we CAN move the first window to the back
-- MOVE FIRST WINDOW TO BACK
tell application "TextWrangler"
set winList to every window
set indexList to index of every window
set nameList to name of every window
--- It appears that the GET of every window always gets in
--- the current stack order
--- MOVE CURRENT WINDOW 1 TO BACK ---
-- Set each window index to 1 in reverse order
-- except for current window 1
repeat with oWin in (items 1 through -2 of reverse of winList)
log (name of oWin)
set index of oWin to 1
On rereading this page I had a thought about moving windows to positions other than 1: the restriction is the same as for applications — you can make an application frontmost, but you can’t rearrange the order of applications (that you would get by ⌘→. The concept both windows and applications are dealing with is simply whether or not they are frontmost — “index 1” for windows, “frontmost true” for applications.
I do wish that Apple provided a way to send a window, and even an application, to the back. In my experience I rarely gave any thought to arbitrary reordering, but I have often wanted to send a window to the back.
Another experiment shows that bringing a window to the front by setting its index to 1 doesn’t give the window focus. The above GIF shows that. Note that the window made front seems to have focus briefly then loses it. Does anyone know how to give the front window the focus? I suppose I can just click on it, but I was hoping for something cleaner.