I have an Autohotkey function that lets me switch between tabs with "Control + left/right" as well as closing tabs (Ctrl-down) and going into the search bar (Ctrl-up). It helps me save clicks and use the mouse less.
However, I use the Canadian Multilingual Standard keyboard to type accents (éèçà) in French for some of my classes and this keyboard DISABLES the right control key (the one right beside my keyboard buttons) which is the most convenient to use with my right hand only.
Here is a source documenting this: http://archives.miloush.net/michkap/archive/2013/04/08/10409187.html
Is there any way I can override this? I very rarely use the letter œ for because I can just use ALT + 0156 instead.
Here is the very simple code for my hotkey!
^Left::SendInput, ^{PGUP}
^Right::SendInput, ^{PGDN}
^Up::SendInput, !d
^Down::SendInput, ^w
Using SciTE4AutoHotkey tool, on my UK hardware keyboard right ctrl is detected as expected (RControl)
When I switch to French (Canada) Canadian Multilingual keyboard,
the right ctrl key is not found, also Virtual Key is different: DF
(SC means scan code and VK means virtual key)
so if you remap, it should solve the problem
~SC11D::RControl
After remapping: not found is replaced by RControl with each keypress.
Even if above remapping does not work for your case, it is a matter of finding which key corresponds to relevant scan code and then you can remap it.
Double click on your ahk script on the taskbar, and then
View > Key history and script info (Ctrl + K) by pressing key and refresh(F5) you can see respective keyboard scan codes.
I've been searching for quite a while and took a look at alot of documentation on AHK, but haven't quite found out how to do this.
So basically, anytime CTRL + another key is pressed, I want to check what the other key is. When the other key is not one of the numpad numbers, I want to only send the other key. When the key is one of the numpad numbers, I want to send CTRL and the numpad key.
Thanks in advance!
I can only think of two ways. Firstly, assigning every hotkey manually.
loop, 255 {
char := chr(a_index - 1)
try {
hotkey, ^%char%, send_key, char
} catch e {
; many keys in the ansi chart cant be assigned to a hotkey, just ignore the error
}
}
return
send_key:
; A_ThisHotkey contains the pressed combination in a format like ^C. Remove the ^
key := subStr(a_thisHotkey, 2)
sendraw %key%
return
The loop iterates over all ANSI characters. See https://msdn.microsoft.com/en-us/library/aa245259(v=vs.60).aspx for a list. It is only a short form for
^a::send a
^b::send b
etc., 255 times. This approach doesn't affect space, numpad numbers (which you want), # and many more, and it also cannot differentiate between lowercase and uppercase letters. But maybe it'll do for you.
Secondly, using input. Read the doc page about it and if you still struggle, edit your question I guess. I don't know if or how this will work for key combinations
My problem :
^space & c::
send {F2}
send {Escape}
but it didn't work, how do I emulate Ctrl+Space + AlphabeticaklKey ?
As my previous speakers said, it can't be done easily. Here's my suggestion, it seems to work fine:
^space::
Loop {
if(GetKeyState("c")) {
break
}
if(!GetKeyState("CTRL") || !GetKeyState("SPACE")) {
return
}
Sleep, 50
}
msgbox, You have pressed CTRL+SPACE+C
return
The code is pretty self-explanatory. When CTRL + SPACE is pressed, it waits until either one of both is released or C is pressed. The latter triggers the actual functionality, otherwise it will return.
I actually don't like it very much, because theoretically it may fail in some cases (e.g. when CTRL + SPACE + C is pressed and released before the execution reaches the check for the state of C; although that seems very unlikely).
Update
There's also a way using #If. I recommend using that since it's more sophisticated and reliable. This is due to the fact that it doesn't need any loops:
#If GetKeyState("SPACE")
^c::Msgbox, You have pressed CTRL+SPACE+C
#If GetKeyState("c")
^space::Msgbox, You have pressed CTRL+SPACE+C
As far as I know, you can only combine two non-hotkey keys with the syntax:
space & c:: msgbox space and c
You can read it here
You can define a custom combination of two keys (except joystick
buttons) by using & between them. In the below example, you would hold
down Numpad0 then press the second key to trigger the hotkey:
Numpad0 & Numpad1::MsgBox You pressed Numpad1 while holding down
Numpad0. Numpad0 & Numpad2::Run Notepad
Trying to use control as well like in: space & c & control or space & ^c or any other combination will result in compile error.
My recommendation is that you don't combine that three keys together. Look for a pure hotkey combination or use another more or less useless key.
#!c:: windows + alt + c
AppsKey & c::
Remember that if you use a normal key as modificator, you have to remap it to itself to keep the original functionality, for example with the menu key (appskey):
AppsKey:: Send {Appskey}
AppsKey & c:: ;do what you want
There are actually a couple ways to get help. First of all the authors of this language have moved to a new domain ahkscript.org. It is always welcome to ask questions like these in our forum. I just happened to be digging through this site today and saw this by accident.
When you have more than one line of code after a hotkey you need to have a return follow it:
^space & c::
send {F2}
send {Escape}
return
Hope that helps
I'm trying to add custom keyboard commands to an application using Autohotkey.
In many of these hotkeys I would like to use the alt key in combination with some other key of my choice (any of the standard letters).
All works fine as long as I don't restrict their usage in such a manner that they work in the target application only (via the #IfWinActive directive ). If I do so, the hotkeys themselves still work, however their behavior is very strange.
I found that they get activated either if
a) I hold down the alt key and then press the second key (in my case the 'b' key) twice
or
b) I use this hotkey two times consecutively with a very short delay between the two triggerings
- The above two cases might actually be 1 case. I'm not sure...
I have no problems when doing the same with Shift or CTRL.
The 'b' key is not what's causing the problem - no alt + 'letter' combination works.
I have tried all SendModes, but so far with no effect.
Code sample:
#IfWinActive, MyAppTitle ahk_class MyAppClass
!b::
click 367, 86
return
Alt+letter commands in AutoHotkey such as !b work without issue. It's possible the version at the time of this post contained certain bugs or was out of date from the current version.
For your code, it could be done like so:
!b::
WinGetTitle, Title, A
if (RegExMatch(Title, "MyAppTitle"))
{
MouseClick, left, 367, 86
}
return
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
For emacs users out there, what are your recommended keyboards?
Bonus points for keyboards that:
Have no capslock key. Instead, a control key in that position.
Alt keys that are closer to the centre, and easier to use with meta key combos. I find alt keys too far to the left to be a bit awkward to hit with my thumb in some key combos.
Help ergonomically with emacs in other ways.
I'm not a huge fan of model M style high and clacky keys. I instead prefer laptop style flat keys; however, I'm not disqualifying either category.
A couple of interesting keyboards I'm curious if people have tried with emacs - Kinesis
Semi-conclusion:
I ended up getting an MS natural 4k, which I like a lot overall as the alt keys on both sides are easy to hit with your thumbs. This is useful for ergoemacs-mode.
However, one flaw I see with this keyboard is that the number keys are shifted to the left, so that 6 is on the wrong side of the keyboard. Aside from that 0 is left shifted enough that I accidentally hit - when I meant to hit 0 with my pinky.
Due to this flaw, I'm leaving this question open in case someone can come up with the perfect emacs keyboard.
Richard Stallman (which I'm sure you all know is the author of Emacs, and probably the biggest Emacs user) was seen using a HHKB (Happy Hacking Keyboard) (source)
Here's the layout of the HHKB Pro:
No Caps Lock.
Control key conveniently placed for Emacs users.
They're quite pricey though...
I used the Kinesis keyboard with Emacs for many years and loved it. Having Alt, Ctrl, Del, and Backspace all easily reachable with the thumbs is very, very nice. The location of the arrow keys is also quite convenient.
I have a model M "Das Keyboard" Ultimate - no letters on it, highly ergonomical and very beneficial to my productivity. I used to share your taste for low profile laptop style keyboards, but ever since I got the Das Keyboard I cannot imagine using another keyboard. It's as noisy and heavy as they get, but it's benefits cannot be described by mere words - one has to type on it for himself... Since you can easily remap CAPS to control(which I've done) I don't think that you should consider something like this in a keyboard a particular advantage. Also - if you get attached to using a keyboard with a highly customized key layout you'll be very impaired when you have to do some work from time to time on a regular keyboard...
I use MS Natural 4K, with some keybindings altered to cope with the different geometry.
In particular, I swapped c-p/n with a-p/n.
My hand and keyboard geometry are such that Alt lies directly under my thumb and I can trivially scroll up and down with thumb of left and and first/third finger of the right hand.
I do not have pinky pain.
Also, I use emacs & MS 4K both at work and at home, and I am pretty much 100% happy with it and plan to continue it.
I recently got a ThinkPad USB TrackPoint Keyboard at work, and is very pleased with it.
I always remap the Caps Lock to act as an extrac Ctrl. When I do need the mouse, the trackpoint is right there, no need to move your hand away from the keyboard.
The keyboard is very flat and I like the feel of the keys. I have a couple of thinkpad laptops as well, and as this is essentially the same keyboard, the feel is the same whether I at my desk or working directly on the laptop - that's a big plus.
Here's some photos: http://www.thinkpads.com/2009/08/31/finally-photos-of-new-thinkpad-usb-trackpoint-keyboard/
There is another keyboard on the way designed for use within emacs, its name is the key64 and is a keyboard i am designing from about two years ago, right now i am finishing building the firmware while all the instructions to make the pcb and the parts needed to make the keyboard are available at its website www.key64.org
It's 100% programmable within Linux with gcc-avr as it use a teensy board.
Hope to finish the firmware by the end of January 2013 and publish it at the website for anyone interested in making his own keyboard :)
as an avid emacs user and long time rsi sufferer, the best solution i found was kinesis combined with footpedals. i program the pedals for Ctrl, Alt, Meta, and thus can use the notorious emacs combos with only a single finger. especially repeated Ctrl sequences work very well in this configuration. obviously you'll need to reprogram the keyboard a little bit, but those changes will be obvious.
I have been using Emacs since 1976, and have had a Kinesis classic for about 8 years now. I used to use it with foot switches for Control and Alt, but have found that it is equally effective to simply swap Backspace with Control, and Delete with Alt. I also swap the left side arrow keys with [ and ] to make it easier to type "[", "{", "}", and "]".
To further ease typing, I have created bindings for common programming language sequences that require shifted symbols. For example, in C++ I map "." to a function that replaces ".." with "->". I have also experimented with word abbrevs that are effective only when preceded by a semicolon, e.g. replacing ";pp" with "++".
I use the Kinesis keyboard most of the time; I've had mine for 10 years and recently retrofitted it with the new Linear Feel "Cherry Reds" and it should be good to go for another 10. But the keyboard is perhaps less important than the keymapping. The basic rule is: don't move your wrists when you're typing, at least not more than you have to.
In order to accommodate this on the Kinesis, I have the bottom row mapped to Hyper, Super, Control, Meta. I have Mode_switch on the thumb keys. So I absolutely never have to move my wrists to type key combos. (I use Mode_switch to connect to an "embedded arrow key" layer.)
You can do something similar on any keyboard, for example, your laptop keyboard -- remap the number row to modifiers, using xmodmap. You can still type Shift+num to get the standard symbols. Here is a minimal xmodmap starter kit. Use xev to customize further.
clear Shift
clear Lock
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5
keycode 9 = s S Left
keycode 10 = d D Down
keycode 11 = f F Right
keycode 21 = w W BackSpace
keycode 22 = e E Up
keycode 23 = r R Delete
keycode 26 = Super_L exclam
keycode 27 = Hyper_L at
keycode 28 = Control_L numbersign sterling
keycode 29 = Meta_L dollar
keycode 30 = F6 asciicircum
keycode 31 = Mode_switch percent
keycode 32 = bracketright braceright
keycode 33 = Control_L parenleft
keycode 34 = Mode_switch ampersand
keycode 35 = bracketleft braceleft
keycode 36 = Meta_L asterisk
keycode 37 = Hyper_L parenright
add Shift = Shift_L Shift_R
add Control = Control_L Control_R
add Mod1 = Meta_L Meta_R
add Mod2 = Hyper_L Hyper_R
add Mod3 = Super_L Super_R
add Mod4 = Mode_switch
add Mod5 = Alt_L
I use a GoldTouch keyboard at work and home, and it works great to keep my arthritis at bay. I've remapped the Caps Lock to the Ctrl-key which helps quite a bit w/emacs-pinky. The Alt-key is a bit problematic, but I've solved some of this with a simple mapping in my .emacs file:
; Replace M-x with C-x C-m or C-x C-c
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-xm" 'execute-extended-command)
Any OS allows you, one way or another, to remap all your keys.
This will improve greatly your speed, as long as you are not one of those who actually have to look at the keyboard while they type.
If you do that, you can then choose the keyboard focusing exclusively on the one which has the best physical keys (just try them).
I use Apple's wide keyboard and it's - for me - the best one I've ever used by far.
I like the Sun Type 6 Keyboard for Emacs - http://www.aquaphoenix.com/graphics/SunKeyboardType6/SunKeyboardType6_front_top-large.jpg
Upvoting MS Natural Pro 4000. It is the only Microsoft product I use on a regular basis and can strongly vouch for it.
I use a traditional keyboard, except that I change Caps Lock key to Ctrl and Document key to Caps Lock.
The Comfort Keyboard Original allows remapping of any keys, including Caps Lock -> Control, and is generally very ergonomic.
Is there anyone using these two keyboards?
http://www.trulyergonomic.com/store/products (trulyergonomic; about 250usd)
http://www.personal-media.co.jp/utronkb/ (utron; over 500usd)
Tooooooooo avoid RSI.