AutoHotkey

This section will be dedicated to AutoHotkey, a scripting language that allows you to control the windows environment. LINK: AutoHotkey

I will be posting my scripts which I think will be useful to other users.

To use the scrips you should first download and install AutoHotkey.
LINK: AutoHotkey Download

HotKeys:

I first encountered AutoHotkey (or AHK) when I was looking for a program that would allow me to create keyboard shortcuts for running my frequently used programs … and became hooked!

The “Windows” key (the one with the windows logo on your keyboard) or “WinKey” is a popular “modifier” key (one that is used in conjunction with a letter or number to create a combination) and is recognised in a script by the “#” sign.

Other common “modifiers” used are:
Ctrl “^”
Alt “!”
Shift “+”

So lets create our first keyboard shortcut to run Notepad.

An AHK script is just a plain text file saved with the .ahk extention

First we need to choose a modifier and a letter (or other) key. Seeing as Notepad begins with “N” we will use that, the modifier will be the “WinKey”.

We write the code like this:

The modifier …

#

The letter …

#N

The :: instructs the script to execute the code that follows it.

#N::

Run is an AHK command that runs external programs, documents, urls and shortcuts.

#N::Run

The following code in this case is the full path to Notepad.exe, which in my case is …

#N::Run C:WindowsNotepad.exe

And thats it!! It’s as easy as that.

Once you have saved your script and named it something along the lines of:
My Keyboard Shortcuts.ahk
… you then run it (double click the icon). It will sit in the system tray (the H icon is AHK) waiting for you to press your hotkeys.

To run Notepad just press: “Winkey“-“N

Web pages can be opened just as easily:

#T::Run https://thesecretpeople.wordpress.com/

That was Hotkeys.

HotStrings:

HotStrings on the other hand are also very useful. A HotString is an abbreviation which is replaced by a line or block of text. So for example:

::#tsp::https://thesecretpeople.wordpress.com/

Typing “#tsp” will cause AHK to replace it with “https://thesecretpeople.wordpress.com/

FYI: I always put a # in front of my abbreviations to stop them from triggering accidentally.

Blocks of text can be used too:

::#myaddress::
(
00 My Street
My Town
MYP05TC0D3
)

#myaddress” will be replaced with the text between the ( )

This is the end of what is a VERY BASIC tutorial that only scratches the surface of what is possible to with AHK.

See here for the official AHK Tutorial and here for the AHK Documentation. The AHK forum is a very good place to get help and download other peoples scripts.

This page has the following sub pages.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s