Apr 102014
 
 April 10, 2014  Posted by at 2:02 pm Dev Environment, Random Tagged with:  Add comments

I’m on a mission. My new laptop, Lenovo, is giving me a lot problems which im sure you heard about if you follow me on Twitter and you can expect a few blog posts on how I end up solving some of them. As I’m remapping my keys I thought I’d share my new use for CapsLock, cut, copy and paste.

Bk29axNCIAAyFPG

This script will cut when pressing shift and CapsLock, copy when clicking just the CapsLock key once, and paste on double click.

I’m using AutoHotKey which you might already know I love. And a certain person likes to make fun of the way I pronounce the name 🙂

Here is a brief introduction to AutoHotKey

And an example of toggling screen resolutions

Download AutoHotKey, and create a file with an .ahk extension. Write the script, and double click on the file to execute it. Its nothing fancy:

~CapsLock::
if (A_PriorHotkey <> “~CapsLock” or A_TimeSincePriorHotkey > 500)
{
KeyWait,  CapsLock
SendInput, ^c
return
}

 

SendInput, ^v
return

+CapsLock::
SendInput, ^x
return

Setting CapsLock off:

SetCapslockState AlwaysOff

Setting up a startup script (run the script when you start the computer) can be done a few different ways.

The easiest way is adding the script to the startup folder:

C:\Users\[UserName]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

4-10-2014 11-00-01 PM

Or use the Task Scheduler. Add a new task, add an action to start a program, add the script path (this is just a mock as I’m on a another computer), and make sure you let the task run even if not on AC power.

4-10-2014 10-18-10 PM

4-10-2014 10-18-38 PM

4-10-2014 10-19-04 PM

  5 Responses to “Mapping CapsLock to cut, copy and paste”

  1. Thank you so much for this!

  2. Interesting. I’ve mapped double-tapping on CapsLock to Control-F4 (child doc close). This is especially handy in VS and browsers, where I can easily, without leaving the home row, close docs after saving/editing,etc. CapsLock will still work, if I press Shift-CapsLock to toggle.

  3. You should paste the script as code in your blog, Iris. You get strange quotemarks when copy+pasting from ordinary text…

    Also, for some reason I don’t understand, the script does not seem to work in Sublime Text… Double-tap capslock does Ctrl+C and then Ctrl+V. But only in Sublime Text!? :S

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 14 + 14 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)