views:

420

answers:

3

Here is what I am trying to accomplish:

  1. To Copy, press and release Caps Lock ONCE
  2. To Paste, press and release Caps Lock TWICE, quickly
  3. To Cut, press Ctrl+Caps Lock

The reason I want to do this is often times i find my self looking down to press the correct X/C/V key, since they're all next to each other (atleast on a QWERTY keyboard).

How can I do this on a standard keyboard (using Windows), so that it applies to the entire system and is transparent to all applications, including to Windows Explorer? If not possible with a standard keyboard, can any of the "programmable numeric keypads" do this you think?

In the above, by "transparent" I mean "the application should never know that this keystroke was translated. It only gets the regular Ctrl+X/C/V code, so it behaves without any problems".

Ps. Not sure of all the tags that are appropriate for this question, so feel free to add more tags.

SOLVED. UPDATE: Thank you to @Jonno_FTW for introducing me to AutoHotKey. I managed all three requirements by adding the following AHK script in the default AutoHotKey.ahk file in My Documents folder:

Ctrl & CapsLock::
  Send ^x
Return   
CapsLock::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 1000)
  Send ^v
Else
  Send ^c
Return

That was easy!

NOT COMPLETELY SOLVED. UPDATE: The above works in Notepad, but NOT in Explorer (copying files for example) or MS Office (even text copying does not work). So, I need to dig around a bit more into AutoHotKey or other solutions. Will post a solution here when I find one. In the meantime, if someone can make AutoHotKey work for everything I need, please reply!

ALL SOLVED. UPDATE: All I had to do was to change the capital "C"/X/Z to lowercase "c"/x/z. So Send ^C became Send ^c. It now works in ALL programs inlcuding Windows Explorer! Fixed code above to reflect this change.

+3  A: 

You need a Global Keyboard Hook.

Eric J.
+1 for being correct, but please note that this method will almost certainly totally disable the caps lock key (though from the OP's examples, this is probably unavoidable, since copy is pressing the button once, ie. using it normally)
Matthew Scharley
i totally want to disable the CapsLock key, so thats fine with me.
Liao
+3  A: 

I believe the program you are looking for is: http://www.autohotkey.com/

Jonno_FTW
cool! My requirement (1) has been satisfied using AHK script `CapsLock::^C`. I think (3) also may be easy. I hope I can do (2)! This is a neat software!
Liao
cooler! it seems (2) is easily met as well with this script:`CapsLock::If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 1000) Send ^VReturn`Now I just need to read the documentation more on how to write a perfect script for my <kbd>Ctrl</kbd>+<kbd>X</kbd>/<kbd>C</kbd>/<kbd>V</kbd> needs.
Liao
Oops. Why didn't the <kbd> tags work?!
Liao
I'm no expert on the program so I can't offer any help, sorry
Jonno_FTW
@jonno_ftw, I meant that the <kbd> tags when posting the comment on StackOverflow did not work.
Liao
A: 

Very nice! Been looking for something like this for a while.

My script is slightly different, making use of shift or control combinations for cut/copy, then CapsLock on its own is always paste.

Ctrl & CapsLock::
  Send ^x
Return

Shift & CapsLock::
  Send ^c
Return

CapsLock::
  Send ^v
Return

If you wanted to retain the option of retaining the Caps Lock function, I presume you could always remap e.g. Alt-CapsLock for this. I couldn't get it to toggle correctly when I tried it though.

Steve