Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Incrementally switch between windows


  • Please log in to reply
153 replies to this topic
Sandeep
  • Members
  • 10 posts
  • Last active: Dec 01 2004 12:29 PM
  • Joined: 29 Nov 2004
Your script works great and it is very useful.
As so many other followers I am trying to unlearn the bad habit of Alt-Tab :(

A little issue I faced with my attempts of using it.
It looks like you have done this intentionally but if I set SetTitleMatchMode to 2 (as in your script), then if a window title is completely included in some other window e.g.
First Window) Windows Explorer pointing to AutoHotKey folder and "Display full path in the title bar" is unchecked, all you see is AutoHotKey in the title bar (I prefer this setting).
Second Window) Internet Explorer pointing to AutoHotKey.com.
Then the window selection is quite unpredictable.
I have changed SetTitleMatchMode to 3 in my script. What is your opinion?
Sandeep

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

It would be really neato to have window thumbnails, like the kind you get when you hover a kasbar item. I know this is a real long shot, but is that possible? Possibly using PrintScreen and the clipboard? That would also be something cool to make using the taskbar. (i.e. on hover a taskbar item, show a screenshot of the window)

I remember seeing an example on MSDN about how to replace the Alt-tab handler with something like this. I think rather than showing the alt-tab menu, it showed miniaturized versions of all the windows.

I don't think it would be easy to do with AutoHotkey now, but there is a plan to add screen-to-clipboard capturing in the future. Perhaps this can be expanded to include window-to-clipboard.

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004

Whoa... I figured after I posted here I should at least try this out, and I was taken aback by this script's resemblance to SlickSwitch. (Separated at birth? :D)

It really seems pretty similar to iswitchw according to the description. I didn't know about Slickswitch, I got the idea from Emacs. I've been using incremental buffer switching in it for years and it has this feature since 1996.

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004

I just had a (maybe) great idea. If anyone here's used a Linux system, you're probably familiar with the Kasbar. It would be really neato to have window thumbnails, like the kind you get when you hover a kasbar item. I know this is a real long shot, but is that possible?

Maybe you should give my naive Expose implementation a try. It's only a toy, but fun. :)

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004

I have changed SetTitleMatchMode to 3 in my script. What is your opinion?

I can't try it, since I'm not on Windows at the moment, but I think title match mode affects only the WinGet command in the script which should collect all visible Windows on the screen. How does your change affect the collection of visible windows?

Sandeep
  • Members
  • 10 posts
  • Last active: Dec 01 2004 12:29 PM
  • Joined: 29 Nov 2004
Besides so many other windowing commands, it does affect WinActivate also!
Sandeep

  • Guests
  • Last active:
  • Joined: --

Besides so many other windowing commands, it does affect WinActivate also!

Yes, of course. :) I should have been a bit more clear.

I meant that title match mode should affect only WinGet in the script beside WinActivate. And if collecting the visible windows works fine with title match mode set to 3 then this is the way to go.

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004
New release.

Changes:

[*:19pbrfja]Using exact title match setting to avoid faulty activation when a window's title contains the title of an other window.
Thanks Sandeep!
[*:19pbrfja]Added option for digit shortcuts if there are ten or less windows in the list.
Thanks to Guest for the suggestion.Edit: See the latest version of the script in the first post.

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004
A few improvements:

[*:qwpkxc1a] The switcher window is always on top. The keyboard focus is grabbed when the switcher is activated and it can be confusing that the keyboard seemingly does not work when the switcher window is behind other windows.
[*:qwpkxc1a] GUI close event is handled to avoid leaving the keyboard grabbed when the switcher is closed with the mouse.
[*:qwpkxc1a] Added first letter match mode where the typed search string must match the first letter of words in the window title (only alphanumeric characters are taken into account)

For example, the search string "ad" matches both of these titles:

AutoHotkey - Documentation
Anne's Diary

Thanks to Soapspoon for the idea.

[*:qwpkxc1a] Added option for activating the currently selected window in the background, so that the user can see which window will be activated. The background activation can be immediate or delayed (by default 300 ms).Edit: See the latest version of the script in the first post.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Nice improvements. I'll be sure to use the latest version when posting this on the web site.

Soapspoon
  • Members
  • 8 posts
  • Last active: Jan 19 2006 07:18 PM
  • Joined: 23 Nov 2004
After attempting to make my own stuff with AHK, I'm just unbelievably impressed with this script. I can't believe you added incremental searching! I don't really understand HOW the code works, but I'll be poring over it to learn from you.

Very nice. Thanks once again, this rocks!

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
If you like learning by example, Soapspoon, you might also want to check out the Script Showcase. It has many excellent scripts that are tried and true, and very helpful in learning more about AHK. Some of the scripts are pretty darn useful, too! Also, browsing old forum topics is a good way to learn too, following the development/support process and finding out how people make scripts and fix bugs, etc. Almost every technique I use has either been learned on the forum here, or from the amazingly helpful Command Reference.

Tekl
  • Members
  • 814 posts
  • Last active: May 03 2009 03:28 PM
  • Joined: 24 Sep 2004
8) Really cool script. I also sometimes hit accidently the capslock, so I don't like the script on this key.

Tekl

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004

I also sometimes hit accidently the capslock, so I don't like the script on this key.

There are three conditions the default activation key should meet:
[*:1arota2m]It should be a single key, not a key combination. Switching between windows is one of the most frequent operations, so the activation of the switcher should be as quick and efficient as possible.
[*:1arota2m]It should be a key which can be found on all kinds of keyboards (101 key, laptop, etc.)
[*:1arota2m]It should be a key which is not often used for its original purpose, so it's only a minor inconvenience if its binding is changed.CapsLock meets the above conditions: it's a big, easy to hit key and I don't know too many people who use it for its original purpose. Typing longer strings of uppercase characters is rarely needed in everyday computing.

That's why I chose CapsLock which I think is suitable for most of the users. Those who don't like it are free to change it to anything else in their copy of the script.

keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004
This update fixes the remaining issues. I hope I haven't introduced too many new ones. :)

[*:1f7s5xzm] Windows are activated by id, not by title. No more messing with title match mode, no more problems with windows having the same title, etc.
[*:1f7s5xzm]Windows with pipe (|) character are handled properly. The pipe characters are simply replaced with dash (-) characters. It causes no problems, since windows are not activated by title anymore.
[*:1f7s5xzm]If activation in background is enabled the selected window is not activated when the switcher is invoked. Sometimes it was confusing when the active window was changed right after the switcher window appeared.Edit: See the latest version of the script in the first post.