Numpad Power User: Mouse Replacement with AltTab, CtrlTab...
#1
Posted 05 June 2008 - 09:46 AM
The script transforms the numpad keys when numlock is off.
>>The hotkey Win-Ctrl-Alt-Shift-m toggles script suspension.
>>It uses / and * for left mouse and right mouse clicks respectively, and 0 and . for X1 and X2 buttons respectively.
>>The 5 button is used for middle click, - and + for scroll up and down respectively; hold down NumpadEnter and press + for scroll right and hold down NumpadEnter and press - to scroll left; hold down numpadenter and press 5 to send either F5 or ctrl-r.
>>Holding down numpadenter and pressing .(del) will send ESC.
>>The keys 1-9 with exception of 5 move the mouse.
>>Holding down NumpadEnter and pressing 3 alt tabs, and holding down NumpadEnter and pressing 1 ShiftAltTabs.
>>Holding down NumpadEnter and pressing 6 Ctrl tabs, holding down NumpadEnter and pressing 4 Shift Ctrl tabs.
>>Holding down NumpadEnter and pressing 8 allows one to move the active window. To stop the moving press the enter key or left click (using / or a real mouse) or again hold down numpadenter and press 8 to keep the changes or press the esc or numpadenter and . to cancel the move, however if the method of movement is utilizing the brutal method (a tooltip will be displayed indicating you are using the brutal method) one must toggle off moving by again holding down numpadenter and pressing 8.
>>Holding down numpadenter and pressing 2 allows the active window to be resized. To stop the sizing press the enter key or left click (using / or a real mouse) or again hold down numpadenter and press 2 to keep the changes or press the esc or numpadenter and . to cancel the size change, however if the method of sizing utilizes the brutal method (a tooltip will be displayed indicating you are using the brutal method) one must toggle off sizing by again holding down numpadenter and pressing 2.
>>Holding down NumpadEnter and Shift and pressing down numpaddown (2) will send F2 or F12 or nothing depending upon whether or not an app's name is listed in neither NumPadEnterF2Custom nor NumPadEnterF2DoNothing or the former or the latter respectively.
>>Holding down NumpadEnter and pressing the arrow keys (not located on the numpad) (possible combinations are Left, Right, Up, Down) results in the window being resized by a set amount for each press.
>>Holding down NumpadEnter and Shift and then pressing the arrow keys (possible combinations are Up, Up and Left, Up and Right, Down, Down and Right, Down and Left, Left, and Right) results in the window being moved to one of 8 possible locations.
>>Holding down NumpadEnter and pressing 7 maximizes or restores a window
>>Holding down NumpadEnter and pressing 9 minimizes a window.
>>Holding down NumpadEnter and pressing / on the numpad will send a left mouse button down event which enables one to move the mouse cursor and highlight text; pressing this again will release the mouse leftbutton down event and then send ctrl-c to copy to the clipboard highlighted texted, etc.
>>Holding down NumpadEnter and pressing * on the numpad will send ctrl-v (a.k.a. paste).
>>Holding down NumpadClear and pressing NumpadDiv (/) will send double click; an alternative to this is when the variable lilalurl_T32 is nonzero and nonempty, numpadclear becomes double click and numpadclear & numpaddiv is middle click.
The script has the X1 button configured to send ctrl-z to wordpad and notepad.exe which is undo. More apps can be added to this list. Similarly redo (ctrl-y) can have apps added to its list.
Suggestions and or comments are welcome. Hope someone besides myself finds this useful.
Edit: Now Version 0.4.6.1
-Fixed: Ctrl Tab Works as Expected on Windows 9x and ME
-Fixed: Mouse Moving during UltraSmooth Events is now almost immediately ended upon release of mousemove keys
-Changed/Fixed: Less "touchy" quick winmove triggers
-Changed: Scrolling Check of of Key's State called more frequently
-Misc: Code Reduction
-Misc: Fine Tuning
-Misc: Reduced Assumptions for down logical state of keys
-Misc: Swapping of GetKeyState for KeyWait
-Misc: Using SendMessage Instead of PostMessage for Scroll Events
Edit: Version 0.4.6.0.1
-Fixed: MultiCore Issues with CreateThread
Edit: Version 0.4.6
-Added: Automatic updating of keyboard delay, keyboard speed, wheel scroll lines, and mouse swap button for NT OS's (excluding Windows NT itself)
-Added: New F2 aspects enabling smart highlighting of file name/file extension
-Removed: No Longer is it possible for Windows 9x/ME users to quickwinmove or quickwinsize windows
-Changed/Fixed: Suspend Hotkey (win-crl-alt-shift-m) works truly as master hotkey
-Changed/Fixed: KeyWait Interval reduced for greater responsiveness
-Changed/Fixed: Suspending hotkeys now results in better detection of what buttons should be released
-Changed/Fixed: Conditional Use of OnMessage for Display Changes based upon OS
-Changed/Fixed: Modulo calls for accelerator increments now working for Dividend less than Divisor
-Changed: ControlSend for Send when sending back and forward events on OS's that don't support X1 and X2 mouse buttons.
-Changed: Scrolling can now be almost immediately ended upon release of scroll keys
-Changed: Mouse Moving during UltraSmooth Events is now almost immediately ended upon release of mousemove keys
-Misc: Code Reduction
Edit: Version 0.4.5.2.1
-Changed: Swapped alt-tab shift-alt-tab hotkeys
-Changed: Swapped ctrl-tab and shift-ctrl-tab hotkeys
-Changed: AltTab for windows 9x and Me, and ctrl-tab no longer send alt-down or ctrl-down with each tab send; also the timer is not reset every time they are initiated
-Changed/Fixed: ctrl-alt-shift-m no longer briefly enables hotkeys
-Fixed: UseErrorLevel correctly used instead of ErrorLevel for F2 and F12
-Fixed: Alt-tab, win-r, win-l, win-e, ctrl-alt-del etc (basically any window stealing focus) during a move or size initiated from the script via postmessage keeps some hotkeys enabled only, at worst, for les than a second
-Fixed: Middle Click now works for Windows 9x and ME (variable/=1000)
-Fixed: Double click using lilalurl_T32 or DoubleClickHotkey now works for Windows 9x and ME
-Fixed: Modifiers now sent under Windows 9x and ME
-Misc: Code Reduction and Cleanup, Settimer call then goto no longer called immediately after
Edit: Version 0.4.5.2
-Fixed: Ctrl Down event without subsequent Ctrl Up event upon exitapp no longer possible.
-Fixed: Windows 9x and ME are now supported for hotkeys that required & (custom combinations) or UP events (see known limitations).
-Fixed: Windows 9x and ME now have support for all mouse events(even X1 and X2 !) except middle click.
-Fixed: On OS's that don't support mouse wheel events postmessage is now always used.
-Changed: No longer will numpad mouse button clicks nor most of the prefix hotkeys use OS's auto repeat (NT family of OS's).
-Added: Setting to use only four mouse buttons (numpadright/left/up/down and in pairs); the remaining four numpad keys previously used for mousemovement have not been assigned not functions (Only4MouseMoveButtons).
-Added: Setting to make NumpadClear (5 on numpad) act as double click and numpadclear & numpaddiv to send Middle click (lilalurl_T32); does not work on Windows 9x and ME.
-Added: Setting to make (the above setting will take precedence over this one here) numpadclear & numpaddiv send double click (DoubleClickHotkey); does not work on Windows 9x and ME.
Edit: Version 0.4.5.1 Fixed: Multiple Monitor support now working for brutal winmove, quick winsize and quick winmove. Fixed: Repeatedly enabling winsize (numpadenter and "2" on numpad) will no longer alter the size (must now use the mouse or mousemove as one would expect). After testing, Windows 9x and ME are now officially unsupported for most of the hotkeys. Added: Detection of 0 monitors.
Edit: Version 0.4.5 added multiple monitor support, and substitutes for X1 X2 and mousewheel events for OS's that don't support such events.
Edit: 0.4.4.1 Added more OS awareness and fixed mousemoves.
Edit: 0.4.4 Added easy highlight, copy, paste and sending of F2 or F12.
Edit: Version 0.4.3 Important Changes included adding a new primary(default) method of moving and sizing windows using postmessage, and solidifying the logic regulating the ultrasmooth setting.
Edit: Version 0.4.2.1 Numlock toggle now works again. In 0.4.2 when numlock toggled off hotkeys were not disabled due to an Else If statement referencing a nonexistent variable (variable removed in 0.4.2).
Edit: Version 0.4.2 Added a consistently smooth mouse and scroll movement.
Edit: All files now in zip format.
Edit: Name of File Changed from NumpadMouse_A.B.C.D.etc.ahk format to PowerUserNumpadMouse_A.B.C.D.etc.zip, where A.B.C.D.etc refers to a version number (e.g. 0.4.1.1). Versions prior to 0.4.2 did not have their names changed (still NumpadMouse) but now in zip format.
Edit: Version 0.4.1.1 fixed UltraSmooth mouse interrupt glitch, X1, X2, and middle click buttons are ignored IF a mousemove key was pressed within a certan time frame, and comments changed to reflect recent key mapping changes.
Edit: Version 0.4.1 added smoother transitions for mousemoves.
Edit: Version 0.4 restored WinMove, WinSize capabilities for non English US and UK users, remapped alttab, shiftalttab and ctrltab, shiftctrltab (again), added Quick WinSize and WinMove. For more information read the comments near the top of script.
Download Latest Version: PowerUserNumpadMouse.ahk
#2
Posted 05 June 2008 - 01:33 PM
One suggestion I could think of would to use a modifier (right control maybe) to have smoother cursor movement.
Right now if you want to move precisely the cursor you have to tap a key a lot of time because otherwise if you hold it there is some acceleration applied.
Thus perhaps by holding right control + movement key you could allow the cursor to move slowly/smoothly (for people using your script for drawing or web sites with a lot of clickable zones).
________
Drug test
#3
Posted 05 June 2008 - 07:39 PM
Very good suggestion. I rarely need such precision, however I can see that many people would need it. Since MS has their own built in numpad mouse replacement tool on some of their OS's and because some people may have used it and become comfortable with it I think I will mimic two attributes of theirs: namely Shift and a mouse movement key to slow down the mouse, and Ctrl and a mouse movement key to provide even quicker acceleration. I will assume that the smooth/slow movement desired is at a rate of one pixel per keystroke with no acceleration. However, I would prefer to hear from you and others who would use the script for such purposes precisely what is desirable before adding this feature.
I am also highly considering adding a window move and resize aspect to the script, as well as F5 (refresh) button on the numpad.
#4
Posted 05 June 2008 - 08:13 PM
In fact that could be helpful even for mouse users who want to draw a series of short straight lines (which is difficult with a mouse and can be tedious going through the 'line' tool of graphic softwares).
Here are two scripts/threads you may find useful for your potential windows move and resize additions, in case you don't know them:
- Easy window dragging <!-- m -->http://www.autohotke...opic.php?t=2823<!-- m -->
You hold CapsLock and hold left click anywhere, ie not only on the title bar, to drag the window.
That would save many mouse moves (no need to go to the title bar) for your script users.
- <!-- m -->http://www.autohotke...opic.php?t=7466<!-- m -->
In this thread, you can find discussions and scripts on how to maximize vertically, horizontally, both and go back to original size. That is not a full resize function but it might be enough for what you are looking to do.
________
Ford Flexible Fuel Vehicle
#5
Posted 06 June 2008 - 01:55 AM
I have modified the script to add fine movement (one pixel) when shift is held down, and 3 times normal mouse speed when holding the control key. There also is now a refresh (NumpadEnter held down then press 5 on numpad), and escape key (NumpadEnter held down then press . on numpad) capabilities. I more than likely will add final touches to error correction and winmove and winsize features in 0.3.
#6
Posted 06 June 2008 - 07:48 PM
I gave a quick try and almost everything seems to work correctly.
My main concern is that the CTRL acceleration didn't work at all. I didn't get any mouse movement at all when holding CTRL. :?
I also have a remark and a question regarding the X buttons assignements.
Since you don't specify anything in 'ShiftCtrlZNonXButtonApps=' I don't know which applications you are thinking of but those I had at hand when testing things Redo through Ctrl+Y (Winword, Paint.net, Notepad++). Then it depends on which apps you use most often (if memory serves well it might be Photoshop that uses shfit+ctrl+z). Anyway, I can report that after modifications it worked perfectly with the three aforementionned apps.
My question, completely out of curiosity, is what does shift+backspace do, in whatever app. you made it for? I checked on google and got results referring to linux distributions or OSX but nothing for windows. Made me wonder :?:
Looking forward to v0.3. And btw, don't worry if I am the only one who seems to pay attention to your script right now. I'm sure people will start noticing it soon, but right now I suppose people who want a mouse replacement already use previously made scripts. They just need time to want to try another solution.
________
Max friz
#7
Posted 06 June 2008 - 10:38 PM
My main concern is that the CTRL acceleration didn't work at all. I didn't get any mouse movement at all when holding CTRL.
Hmm... it has worked fine for me, perhaps when I posted something went wrong. Let me know if 0.3 works for you. I didn't change the ctrl aspect so whatever problems you experienced may still persist.
Since you don't specify anything in 'ShiftCtrlZNonXButtonApps=' I don't know which applications you are thinking of but those I had at hand when testing things Redo through Ctrl+Y (Winword, Paint.net, Notepad++). Then it depends on which apps you use most often (if memory serves well it might be Photoshop that uses shfit+ctrl+z)
Good catch! I have a hotkey setup in another program that hooks ctrl-shift-z and sends ctrl-y (I always felt more comfortable getting to redo this way) so I naturally entered ctrl-shift-z as the key. Since most people do not have their systems set up this way I changed it to now send ctrl-y.
what does shift+backspace do, in whatever app. you made it for?
Browsers use backspace and shiftbackspace for navigating history. Although the X1 button is practically {Alt Down}{Left}{Alt Up} and X2 button is practically {Alt Down}{Right}{Alt Up} I anticipate some users having problems with X1 and X2 being sent (older OS's or older apps probably won't support this) and may require an alternate way of going backward/forward particularly in browsers. It is there only as an emergency backup plan. Perhaps I will remove it later.
To all readers, lilalurl.T32 in particular, I am planning to change the Thread's Subject from "Numpad Power User" to "Numpad Power User: Mouse Replacement, CtrlTab and AltTab substitute, with Window Manipulation aspects, and ...."
#8
Posted 07 June 2008 - 01:33 AM
WinMove and WinSize work too but with a slight problem.
Since I use the French version of Windows, some keyboard 'underlined one-letter shortcuts' are not the same. Therefore I had to edit the script and use:
- l instead of m for move
- t instead of s for size
For me it is not a big deal but there is a potential problem for any non-English users.
When you release the final version, it could be pointed out in a readme or at the beginning of the script, with a few examples.
However, if you have time and are willing to, you may find an alternative way for moving in that easy window drag script I mentionned earlier. I don't know if something similar exists for resizing though.
Nevertheless, your script is quite funtional as it is.
As a side note, I found two applications in which those functions didn't work (but the easy window drag script doesn't either and I guess there are good reasons why): they are winamp (5.31) and KMP (Korean Media Player 2.9.3.1428, which borrows a lot from winamp for the GUI from what I read). It may also be the case for some IM applications (ICQ? Skype? don't have them at hand to test) or other applications using some sort of custom GUI.
A bit of searching and I found that problem has already been noticed and has apparently not been solved: <!-- m -->http://www.autohotke...opic.php?t=1980<!-- m -->
Thanks for the shift+backspace explanation. I knew for backspace going to the previous page but didn't know for shift+backspace (actually, I never use the forward function).
Since backspace also go backwards in windows explorer, that part might prove useful for file browsing, although windows explorer doesn't seem to understand shift+backspace.
________
Hotbox vaporizer
#9
Posted 07 June 2008 - 03:47 AM
As a side note, I found two applications in which those functions didn't work (but the easy window drag script doesn't either and I guess there are good reasons why): they are
Although the script doesn't clearly show it, I knew that my script would encounter difficulties when dealing with apps having custom guis, and that is why I created a variable NonWinSysMenuApps to store just such an app's name. I am a fan of KMPlayer so I assigned it to NonWinSysMenuApps as part of the default configuration. In the forthcoming version 0.4 I intend to have full winmove and winsize capabilities for all apps regardless of their gui types (provided the window itself can be resized and or moved by use of a real mouse).
Since backspace also go backwards in windows explorer, that part might prove useful for file browsing, although windows explorer doesn't seem to understand shift+backspace.
Since you are interested in the matter, {backspace} in explorer does not actually go backwards in your file exploration history. What it does is navigate up one directory, i.e. it goes to the parent directory. What is really revealing is that by observing the behavior of {backspace} in various explorer windows one can learn that there are really two completely different exploration views using explorer: namely My Computer view and Explorer. If one clicks on the "My Documents" (preVista) icon on the desktop one has arrived at the My Computer view. How does one know this? Well press backspace and you will see that it will navigate you to your desktop (on NT systems). Whereas, if you navigated through directories to arrive at My Documents and then pressed backspace on NT systems you would find yourself at C:\Documents and Settings\%username%. Vista's a little bit different but the concept is the same. Hope I didn't bore you.
#10
Posted 07 June 2008 - 03:48 PM
As a silly sidenote, I am not sure if I am right but I presume, judging from the dropdown list in the language and region settings control panel in Windows; that by only allowing US and UK English you prevent Canada, Australia, South Africa etc... English users from using these functions too.:wink:
If v0.4 delivers winmove and winsize regardless of language and of non-standard GUIs that will be some achievement. As far as I know (including my quick search yesterday and I am far from pretenting to know all the scripts having been made) there is no AHK script allowing that for non-standard GUIs.
As for backspace behaviour, thanks for the explanations (not boring at all). Actually, these days I mainly use Directory Opus as a file manager, which automatically translates my docs to C:\Documents and Settings\%username%\my docs if I click on the my docs icon on the desktop. But by disabling it things behaved as you described.
________
Dt125
#11
Posted 07 June 2008 - 07:45 PM
As a silly sidenote, I am not sure if I am right but I presume, judging from the dropdown list in the language and region settings control panel in Windows; that by only allowing US and UK English you prevent Canada, Australia, South Africa etc... English users from using these functions too.
Because I am unsure as to whether changing to a different English locale also changes the menu shortcut words Move and Size, and at this time am not up to testing this idea, I have played it safe and only allowed English speakers of UK and US locale preferences. If someone could point out some MS site documenting this I'd appreciate it.
If v0.4 delivers winmove and winsize regardless of language and of non-standard GUIs that will be some achievement. As far as I know (including my quick search yesterday and I am far from pretenting to know all the scripts having been made) there is no AHK script allowing that for non-standard GUIs.
Well, with the code I have so far I am now able to resize and move the nonstandard gui of KMPlayer (only one tested so far). Although the technique employed is smooth it is more cpu intensive than using "Move" "Size" method from the menu. For this reason all windows, unless they are specified in NonWinSysMenuApps, or completely opted out in NonWinMoveApps and or NonWinSizeApps which will absolutely under no numpad shortcut allow those apps to be moved or resized respectively, will use the menu move/size technique. That is for custom guis the only way you will get them to resize or move will be to list the app's name in NonWinSysMenuApps.
As for backspace behaviour, thanks for the explanations (not boring at all).
You're welcome, and I am glad it was not too boring.
By the way, to those curious 0.4 will either be released Sunday or Monday (20080608 or 20080609). I'd like to finish adding F2 and Auto-Scroll by then, but those may not be done until 0.45.
#12
Posted 09 June 2008 - 10:37 PM
- Tertius
#13
Posted 10 June 2008 - 12:57 AM
First most things work as advertised:)
1) You need to change the 'Numpadshift Keys and their Functions' section to reflect the remapping to numpadenter+1 and numpadenter+4.
2) in the same section you should specify CTRL and shift speed modification also work for winmove and winsize (can be quite useful).
3a) How is the anchor point for resizing determined when activating winsize mode? Sometimes I got top left corner, sometimes top right corner or the bottom corners. Something related to the cursor position when activating winsize I suppose.
3b)After double checking it seems it is the diagonally opposed corner (ie cursor top left -> resize anchored bottom right).
3c) Anyway, it feels kind of weird when compared to the numpadenter + cursor keys resize which is always anchored top left. But I suppose it just need to get used to. You should specify it in the description section mayba.
4a) Also, winsize has a kind of weird behaviour in winamp (even in the playlist editor which is a rather standard windows): sometimes it works ok but sometimes I just can't figure where the anchor is. More exactly it feels like directions are inverted. I'll need to try again tomorrow to give a proper description.
4aa) As a sidenote I must say Winamp main window GUI is really weird:shock:. Seems to be made of two parts ( the bar and the other part), with some static elements (the equalizer background, the arrow under video/vis). Well, at least thanks to your script I have discovered it can also display a beat visualization graph when largely resized.
4b) Winmove didn't work at all in winamp.
5) On the other hand, both winsize and winmove work like a charm in KMP.
6) Regarding quickmove I think it works as it should but I find the resulting positions a bit strange. But I think it is a WIP since I believe you don't use all the positions defined in the Quick Move Locations section.
________
EXTREME VAPORIZER REVIEW
#14
Posted 10 June 2008 - 02:53 AM
In the meantime, for the curious, I will briefly explain the winsize, quick winmove and winsize aspects. The brute force winsize method, which as of now is the only method implemented, has some smart logic to it that determines how to resize based upon the mouse's position with respect to the four quadrants of the active window. If, for example, the mouse is in the bottom left quadrant of the active window or below or left of that, the brute force winsize method is meant to simulate how the window would be sized if one had simply moved the mouse cursor to the the active window's closest corner (bottom left corner in this case) and left click dragged the window. The idea was just to reduce the time of moving the mouse cursor to this point and just start sizing according to how one moved the mouse cursor.
The quick winsize method is also brute force but only allows one to increase or decrease the size and width while keeping the window's position (the window's top left corner) stationary. Although I will likely change this, the reason behind having the top left corner stationary was to make the action a very simple and straighforward one with only a small amount of code.
The logic in coming up with what you see in the quick winmove aspects of the script rests on the idea that the screen is divided into 9 regions of equal size. To reduce window clutter in the center of the screen one can move the windows to all of the other 8 regions and leave one window in the center. Why 9 regions? There are 10 possible one or two key combinations available with the up/right/left/down arrow keys however pressing both up and down or left and right at the same time is ambigious, so those two aside there are 8 reasonable combinations. So, what about the ninth position? There is no need for a ninth because the center window is already in its desired place.
I am open to suggestions for better/more practical quick window position placement, and quick window size aspects, so run them by me.
As for WinAmp, I will probably have to download the app and run it in order to troubleshoot these difficulties. I'll see what I can do.
- Tertius
#15
Posted 10 June 2008 - 08:12 AM
- Tertius




