Sunday, May 10, 2009

How I Use AutoHotKey: I

I use AutoHotkey extensively. In fact, AutoHotKey and ConnectedText are—apart from Firefox, perhaps—the applications I use most. Perhaps some people will find interesting how I use it.

First, I prefer to have one large script file, called "Mine.ahk," in which I collect all the scripts I use. It's in the Startup folder. Here is the Header of this file:

; BEGIN
; This part of the script automatically loads the file, in which this script, whenever it is loaded.
; ATTENTION! The script must be at the very top of the file
; I copied this from a script in the German AutoHotkey Form, but forgot who is the author.
SetTimer,UPDATEDSCRIPT,1000
UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
FileSetAttrib,-A,%A_ScriptFullPath%
SplashTextOn,,,Updated script,
Sleep,500
Reload
}
Return

#Persistent ; Keep the script running until the user exits it.
#SingleInstance force

;--------------------------------------------------------
;General |
;--------------------------------------------------------

InstallKeybdHook

#UseHook ; This is need to change the keys on a keyboard sot that A becomes B, for instance

Capslock::ctrl

+Capslock::capslock

AppsKey::RWin

;--------------------------------------------------------
;edit authotkey script |
;--------------------------------------------------------
^/:: ; this part makes the short cut "CTRL-/" open the script for editing
IfWinNotActive ahk_class Notepad
{
Edit
}
else
{
SendInput ^s
Sleep 100
Reload
}
return

What follows ";" are comments.

This part of the script has remained constant over the years.

No comments: