AutoHotkey Community

It is currently May 25th, 2012, 10:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: February 27th, 2005, 7:57 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2005, 10:59 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2005, 8:43 pm 
Offline

Joined: February 15th, 2005, 8:24 pm
Posts: 19
Location: Ludwigsburg, Germany
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2005, 8:52 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
It's working fine for me.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2005, 9:08 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
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 :)

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2005, 9:28 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
I tried that once; it was too slow for me and I like tabbed applications better than SDI's anyway.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ALT-TAB Mouse Wheel
PostPosted: March 9th, 2005, 2:14 pm 
Offline

Joined: February 9th, 2005, 9:18 pm
Posts: 17
Location: United States
This code
Code:
MButton::AltTabMenu
WheelDown::AltTab
WheelUp::ShiftAltTab

works beautifully! I am still being amazed by this program (AutoHotkey). It is excellent!

_________________
RG


Report this post
Top
 Profile  
Reply with quote  
 Post subject: best Alt-Tabber
PostPosted: March 9th, 2005, 4:36 pm 
Offline

Joined: February 25th, 2005, 5:05 pm
Posts: 11
Location: Germany
This one is just the best Alt-Tabber: http://taskswitchxp.sourceforge.net/
I recommend (and use) the latest 'n greatest beta version 2.0b4: best http://sourceforge.net/projects/taskswitchxp/

HS2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2005, 4:49 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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. :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2005, 1:08 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2005, 9:25 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: middle mouse button
PostPosted: June 2nd, 2005, 5:07 pm 
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?


Report this post
Top
  
Reply with quote  
 Post subject: Re: middle mouse button
PostPosted: June 2nd, 2005, 9:39 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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 August 17th, 2005, 12:13 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 16th, 2005, 11:38 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2005, 3:54 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: ELengefeld and 4 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group