Activate the frontmost window in the previous app.

Hello.

Some windows of some apps doesn’t even have a visible property. :slight_smile: I have also forked out a script object for practical purposes, in the post above.

Hello.

I have removed one more bug, the issue was when there were just one window in this space, and windows in other spaces, and I tried to hide the window, and make it visible again, then I would remain in the other space.

That is fixed now, by a little test on the window count in the current space.

Ok, so I removed the choose dialog for the case where the app has just one window totally in every space.

There are probably still some glitches here, when an app isn’t scriptable and so on, but this is as good as it gets from my side, to pick a window among those you have in the current space, or select from all spaces if you have no more than one window. If you have none, then you command - tab to the app. The script is in post #7 together with a skeleton for an app, so you can use it from various places.

Invisible windows, that should have stayed invisible started to turn up as a result of former fixes. It is updated in post #7.

Now it moves you into the space where a window resides, if the window you chose didn’t reside in the current space, (if you had just one window in this space, you’ll get the opportunity to select windows from other spaces, if the app has any). It is all in post #7.

Factored out a subroutine, and tested it thoroughly, with document based and non documentbased apps. It should work as intended for applications that are scriptable.

One last bug is fixed. The problem was not getting the window to front, when the window is residing in another space.

:slight_smile: I had to differentiate between cases where there were just one window in another space, and more than one.

Perfect, as far as it goes. :slight_smile:

Apart from when there were multiple windows in the current space. :confused: That is fixed now.

It is totally finished. I really need that script object, that’s why I have bothered all of this, if you wonder. :slight_smile:
So the finished thing resides in post # 7.

It is a script called Pike, that lets you pick a window from any app that is active in current space, if there is just one window active in current space, then you are allowed to select windows in other spaces.

The idea is that if you want something “new”, from an app that isn’t there then you’ll switch or fire up that app, and arrange things as you want.

Fixed one bug relating to activating a window in another space, when there is just one window. There are still problems when there are several windows in another space, and you want to get a window that is not the front in that space (index = 1 ), I can’t bypass bringing all of the windows of that app in the front of the other windows in that space then. Maybe I’ll fix this one day, but I fear it will be a rather slow solution in AppleScript.

One thing I have forgotten to mention is that the whole thing relies on auto-swooshing of windows, that is, when you select a window in another space, that space is activated/you are taken to that space (pick your view).

You activate auot-swooshing by entering this from the command line:

.

The whole setup also works best with apps, that aren’t dedicated to any space, nor all spaces.

And the right version is posted in post #7 above.

Wait so can I use this along with the script that you helped me edit that uses UIElements to connect to bluetooth devices so that it would seem like I had not even opened up system preferences to connect to the bluetooth device?

I am sorry for this whole thread, but it works as should at my place.

With auto-swoosh enabled and all. It is practical, but its not comfortable, and perfect in any sense I realize that now.

Hi McUsr,

That is a puzzle. How do you make just one window of an app frontmost? does it work? I’ll read it later. Interesting.

Hello.

There are certain situations where that won’t work, and that is, when there are more than one window in another space, from that app which window you want to bring to the foreground, as it is I have no way of bringing just that window forward.( if it is followed immediately by an window of the same app, in the z-order (front to back ordering of the windows).

I hope you try it, and find it useful.

I am still working on it, to make it more friendly, as even I are at a loss at times.

Later today, I’ll post a new version, this version will gather all windows, from the app that are active in the current space, regardless, if it has only one window open there, or not. I’ll also use “Stone’s ticks” on the windows that are from the current space, to differentiate between “native” and “foreign” windows.

OK.

Even more bugfixes, when a user escapes out of a choose from list, and leaves the screen in a more tranquil state, with regards to windows visible, and frontmost, before and after a cancel.

All windows for an app will be visible in the window list dialog, if it has any, but this behaviour can be changed by a property.

There is no way to just activate a window from an app in another space, and bring that to front, without bringing the windows of that app in your current space to front. So the price for jumping to a window in another space, is that you rearrange the window layout in your current space. The second caveat is that all windows of the same app will be brought to front, once activated, because I have to activate the app, to make the jump to the window.

This could have been fixed by ui scripting the window menu, and jump from there, right now I am fed up with it… :wink:

Hello.

It still disrupts your screen a whole lot less, when you have many windows open in an app, compared to the usual way of getting a window: activating an app, and then looking for the window.

And, my test shows that it disrupt the screens less than command tab (choose app ) 1.

So. In my eyes, it is an improvement, although small. (Not worth it.)

(You really need to have auto-swoosh enabled to see any benefits by this script, this is described in post #7 where you also find the script.

Hello.

I had to implement a time out for cases where the app you want to get a window list from is busy, and then bail out with a dialog about the situation.

This doesn’t happen often but say if you left an app in a modal dialog, then it may.