ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Super Efficient Extended Hotkey Mapper

<< < (2/5) > >>

nudone:
sounds like a good idea.

wr975:
Note this could probably be done with something like AutoHotKey
--- End quote ---

AFAIK such global hotkey feature was the (main) reason why the author of AHK left AutoIt and created AHK.  ;)


AHK can catch any hotkey/mouse-click combination and send own keys.

Adding a simple "IfWinActive" command, you can send different keys to different applications.

Example, if I middle-click in my browser, AHK sends a shortcut combination. In my emailer it sends a different shortcut combination. And in all other application it sends a standard middle-click.


Of course, an own GUI driven program would be easier to use. No doubt.

NeilS:
Although I can understand the desire to have a small, fast app to provide this functionality, it's fairly easy to do with AHK, and I don't find AHK that much of a system hog anyway. Using AHK also has the advantage that you can do plenty of other things besides sending alternative keystrokes, if you need to.

I've just added a simple double tap feature to my default AHK script (which runs at startup and provides most of my global hotkeys). One nice thing about this is that it's one less tray icon to worry about, and also minimises the overhead of running multiple hotkey processes.

The code for this is pretty simple. Near the top of my script, I have the following function:


--- ---DoubleKey(key, timeout, sendKeys)
{
  global
 
  if(tapped%key% and (A_TickCount - tapTime%key% < timeout))
  {
    Send, %sendKeys%
    tapped%key% = 0
  }
  else
  {
    tapped%key% = 1
    tapTime%key% := A_TickCount
  }
}

And then to use it, I just create a hotkey which calls this function. For example, my FARR double tap hotkey is as follows:


--- ---Ctrl:: DoubleKey("ctrl", 500, "^!k")

The "^!k" is the CTRL+ALT+K key sequence I use to bring up FARR normally, and the 500 is the time allowed between the two taps in milliseconds - if you wait any longer before pressing CTRL again, it resets and you have to tap twice again.

The "crtl" is used by the function to distinguish between different double tap keys. For example, if I also set up a hotkey for a double tap of SHIFT, it's probably better if the state of the double tap is kept separate from the state of any CTRL double tap, so the "ctrl" is used as part of the state variable names. The SHIFT hotkey would use "shift" (or anything else, so long as it's different from "ctrl"). If you don't do this, then SHIFT followed quickly by CTRL would fire the CTRL sequence, as if CTRL had been pressed twice.

Interestingly, it might be possible to make use of this kind of sequence, e.g. SHIFT then CTRL could fire a different sequence from CTRL-CTRL or SHIFT-SHIFT, as could CTRL-SHIFT. My current script can't do this, but it should be possible.

The only thing I haven't managed to solve yet is using the left and right SHIFT/CONTROL keys separately. If you use the LCtrl/RCtrl/LShift/RShift hotkeys in AHK, there seems to be some sort of repetition happening, which causes the sequence to fire any time you hold those particular keys down. I'll see if I can fix that when I have more time, but the current code seems to work very well for the Ctrl, Shift and Alt hotkeys.

mouser:
really nice work neil - i knew it would be easy in ahk, but that's quite impressive.

jgpaiva:
Cool work, NeilS. I think i'll be using that script pretty soon ;)
I love the way it's encapsulated into a neat function.

The only thing I haven't managed to solve yet is using the left and right SHIFT/CONTROL keys separately. If you use the LCtrl/RCtrl/LShift/RShift hotkeys in AHK, there seems to be some sort of repetition happening, which causes the sequence to fire any time you hold those particular keys down. I'll see if I can fix that when I have more time, but the current code seems to work very well for the Ctrl, Shift and Alt hotkeys.
-NeilS (October 25, 2006, 09:52 PM)
--- End quote ---

If you feel it's ahk's fault, post ait at the ahk forum. I'm sure they'll be able to provide a solution or if there is no solution, they'll solve it on the next release. At least, that's how it's happened with me ;)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version