| View previous topic :: View next topic |
| Author |
Message |
Brandon Pace Guest
|
Posted: Sun Feb 27, 2005 7:57 pm Post subject: Alt+Tab Action for the Mouse Wheel |
|
|
Old versions of Microsoft's IntelliPoint software allowed users to assign the Alt+Tab action to the mouse wheel button. Somewhere after IntelliPoint 4.0 this functionallity was removed.
I wrote the code below to give Alt+Tab functionallity to the mouse wheel button. IntelliPoint is not required. Put the file in your startup folder to have it load every time Windows starts. For example, in Windows XP, you could place it in the folder C:\Documents and Settings\All Users\Start Menu\Programs\Startup.
Click the mouse wheel to switch to the last window viewed. Hold the mouse wheel down to switch to a window of your choice -- no scrolling required.
_______________________________________________
#NoTrayIcon
*MButton::
GetKeyState, CapsState, CapsLock, T
If CapsState = D
SetCapsLockState, Off
Send, {AltDown}{Tab}
Sleep, 200
Loop
{
GetKeyState, WheelState, MButton, P
If WheelState = D
Sleep, 400
GetKeyState, WheelState, MButton, P
If WheelState = D
Send, {Tab}
Else
{
Send, {AltUp}
Break
}
}
Send, {AltUp}
If CapsState = D
SetCapsLockState, On
_______________________________________________
Keywords: alt, tab, alt+tab, alt-tab, switch, mouse, wheel, wheel button, window, next window, last window |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Feb 27, 2005 10:59 pm Post subject: |
|
|
Nice. If you haven't already, you might try the following as well. I find it quite convenient:
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab
Click the wheel to show or hide the menu, and turn it to navigate through the menu. The wheel will still function normally whenever the Alt-Tab menu isn't visible. |
|
| Back to top |
|
 |
ULTRA
Joined: 15 Feb 2005 Posts: 18 Location: Ludwigsburg, Germany
|
Posted: Wed Mar 02, 2005 8:43 pm Post subject: |
|
|
Chris, when I try to use this...
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab
... it doesn't work correctly. For me it only makes the selected window
flash on the taskbar but it doesn't bring it to the top and it doesn't give focus to it.
When I use something like....
MButton::
Send, {LAlt Down}{TAB}
Sleep, 2000
Send, {LAlt Up}
return
... it does bring the selected window correctly to the top and activates it.
I looked at the source-code and I think it must have to do with this section
in hook_include.cpp:
| Code: | if (alt_tab_menu_is_visible) // Can be true even if which_alt_down is zero.
{
if (hotkey_id_to_fire != HOTKEY_ID_ALT_TAB_AND_MENU) // then it is MENU or DISMISS.
{
KeyEvent(KEYUP, which_alt_down ? which_alt_down : VK_MENU);
if (this_key.as_modifiersLR && vk != VK_LWIN && vk != VK_RWIN && !key_up)
KeyEvent(KEYUP, vk); // Can't send sc here since it's not defined for the mouse hook.
alt_tab_menu_is_visible = false;
break;
}
} |
Anyone else having this behavior? _________________ In a world without walls and fences who needs windows and gates? |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Mar 02, 2005 8:52 pm Post subject: |
|
|
| It's working fine for me. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5107 Location: eth0
|
Posted: Wed Mar 02, 2005 9:08 pm Post subject: |
|
|
For those WinXP users who don't know already; the Alt-Tab Replacement Powertoy really comes in handy as it shows previews of windows in Alt-Tab; something I felt like sharing  _________________
RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Mar 02, 2005 9:28 pm Post subject: |
|
|
| I tried that once; it was too slow for me and I like tabbed applications better than SDI's anyway. |
|
| Back to top |
|
 |
RG
Joined: 09 Feb 2005 Posts: 17 Location: United States
|
Posted: Wed Mar 09, 2005 2:14 pm Post subject: ALT-TAB Mouse Wheel |
|
|
This code
| Code: |
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab
|
works beautifully! I am still being amazed by this program (AutoHotkey). It is excellent! _________________ RG |
|
| Back to top |
|
 |
hs2
Joined: 25 Feb 2005 Posts: 11 Location: Germany
|
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Mar 09, 2005 4:49 pm Post subject: |
|
|
Taskswitch-XP is great, but I don't use it 'cause I've been trying to limit my resource usage lately. Also, it doesn't get along well with Windowblinds, and when an app does that, it's usually not Windowblinds that gets the boot.  |
|
| Back to top |
|
 |
Brandon Pace Guest
|
Posted: Wed Apr 27, 2005 1:08 am Post subject: |
|
|
I found a script I like better than the one I posted previously. This one makes use of the AltTab function Chris suggested. Just press and hold the right mouse button and use the left button to switch between windows. It seems to work fine on Win 2k and XP.
| Code: | Rbutton & LButton::AltTab
$RButton::MouseClick, right |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Apr 27, 2005 9:25 pm Post subject: |
|
|
Here is a slight variation of the above that allows anything that relies on the right mouse to be held down (such as games and right-click-drag of a file in Explorer) to continue to work. However, pressing the right mouse button will cause a right-click-down event, which might cause undesirable side-effects depending on where you click:
~Rbutton & LButton::AltTab
RButton::MouseClick, right,,,,, D
RButton up::MouseClick, right,,,,, U ; This method allows right-click-drag to work. |
|
| Back to top |
|
 |
Sith Guest
|
Posted: Thu Jun 02, 2005 5:07 pm Post subject: middle mouse button |
|
|
Thanks Chris for sharing that script.
I was originally trying to get my middle mouse button click to switch between applications. as i rarely use the middle button click event for anything much.
Whatever I tried just wouldnt work, but I know that the middle mouse button is working, as the example from the help file worked, where I could bring up the AltTab menu with middle button click.
this is what tried to get the middle mouse button to switch apps without success;
MButton::AltTab
any ideas? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Jun 02, 2005 9:39 pm Post subject: Re: middle mouse button |
|
|
| Sith wrote: | this is what tried to get the middle mouse button to switch apps without success;
MButton::AltTab | The built-in Alt-tab actions require hotkeys that are combination of two keys (such as RControl & RShift::). By contrast, displaying the alt-tab menu/window via AltTabMenu can be assigned to an unmodified hotkey.
You may have already tried the following example, but if so perhaps you can describe how the behavior you want is different from what it gives:
; Clicking the button will display the menu and turning the wheel will navigate through it:
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab
Last edited by Chris on Wed Aug 17, 2005 12:13 am; edited 1 time in total |
|
| Back to top |
|
 |
urev Guest
|
Posted: Tue Aug 16, 2005 11:38 am Post subject: |
|
|
Hi!
I am searching for the following thing:
If I press the midde mouse button, the task menu appears. Scrolling the mouse wheel up and down, the focused program changes and will be selected with left or middle button mouse button or return. Right button or any other key will escape from the tast menu.
Without prior pressing the middle mouse button, the wheel up and down should behave as before (e.g. for scrolling web pages).
I don't know how to implement this behavior, but perhaps you can help me.
bye, urev |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Aug 18, 2005 3:54 am Post subject: |
|
|
The following script seems close to what you want. Clicking the middle button will display the menu and turning the wheel will navigate through it. This script is not supported on Windows 9x:
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab |
|
| Back to top |
|
 |
|