Tuesday, 17 February 2009

Automate things with AutoHotKey

AutoHotKey helps us automate things so we can increase our productivity. We can download AutoHotKey
at http://www.autohotkey.com/download/ and install. After installation, create a file with .ahk extension.
Edit the file using text editor and we can start our new AutoHotKey script. We can run the script by doulble
click the files on explorer.

With AutoHotKey we can remap any keys, write down this line:

a:: z

Save and execute the file. After you execute this, everytime you type 'a' it will be recognized as 'z'.
So if you attempt to type 'zaaap' it will become 'zzzzp'.

Another simple example, we can remap keys become shortcut.

^n:: Run Notepad

With this script, we can automatically run notepad by pressing Ctrl+n. '^' symbol represent Ctrl key. This is
the complete list:
^ = Ctrl
+ = Shift
# = Win
! = Alt
* = [wildcards, any above key]

The statement 'Run Notepad' simulates 'Run menu', type 'Notepad', then click 'Ok'.

Another usefull feature of AutoHotKey is as typing tool.

::wtf::What the f**k

This will replace any typing 'wtf' into 'What the f**k' just like autocorrect.

There are still plenty of usefull features that AutoHotKey can do, like moving your mouse cursor using your keyboard,
block some keyboard key, create hotkeys, and others.

These examples can automate your work :

; ----start of code-----
; line in semicolon will be considered as comments
; Shortcut : Win+hotkeys
#g:: Run http://www.google.com
#i:: Run "C:\Program Files\Internet Explorer\iexplore.exe"
#n:: Run "C:\Program Files\Notepad++\notepad++.exe"
#o:: Run "C:\Program Files\Opera\opera.exe"
#v:: Run "C:\Program Files\VideoLAN\VLC\vlc.exe"
#w:: Run "C:\Program Files\Winamp\winamp.exe"
#y:: Run http://www.yahoo.com

; disable some key
; modify CapsLock so you must press Shift+CapsLock to trigger the key it
+CapsLock:: CapsLock
*CapsLock::
; do nothing
Return

; modify ScrollLock so you must press Shift+ScrollLock to trigger the key
+ScrollLock:: ScrollLock
*ScrollLock::
; do nothing
Return

; for autocomplete
::btw::by the way
::wtf::what the f**k
::omg::oh my God!!!!

; ----end of code-----

No comments:

Post a Comment