Posts Tagged ‘AutoHotKey Scripts’

AutoHotKey Scripting Basics - The RunWait Command

Saturday, November 1st, 2008

The RunWait command is an extension of the Run command. However, as the name suggest, the RunWait command waits for the specified program to finish executing before continuing.

To simplify further, let’s consider once again the multi-line script example from the previous post:

#m::
Run Notepad
Run www.yahoo.com
Run Calculator
Run www.google.com
return

As I explained before, when you press the Win+m keys on your keyboard, the Run command will open these programs in a top-down sequential manner. But with the Run Command you can specify that the program on the next line opens only once the previous one has finished executing. As an example:

^n::
RunWait Notepad
Run www.yahoo.com
return

When you press Ctrl+N on your keyboard, the Notepad will open on your screen, and only after you close it will the Web site yahoo.com open up in your browser.

If you have to work repeatedly on certain applications in a specific order, you will find the RunWait command really useful. With just one little script, you will never need to bother opening these programs manually. I should warn you though, this gets addictive.

Meghna

AutoHotKey Scripting Basics: The Run Command

Friday, October 10th, 2008

I have already used the Run command in two of my previous posts: Launching Google and Launching Calculator using AutoHotKeys.

The Run command is used to launch a program, document, URL, and even shortcuts.

Most of you must already be familiar with the Windows version of the Run Command. If you are not, try this:

Click on Start –> Run

A Run command window will now open; just type in the name of the program or complete URL of the Web site you want to open. For documents, however, you need to specify the complete path.
For e.g. C:\My Documents\Meghna.doc

Note: The Windows Operating System treats Notepad as a Program and Microsoft Word as a document. Thus, typing Microsft Word in the Run command box will give you an error and instead you need to specify the complete path for it.

AutoHotKeys allows you to have lot more fun with the Run command. You can launch multiple programs or Web sites at once, choose how they open, specify working directories, pass parameters etc. 

Let me just start off with showing you one of its simplest uses: Launching multiple programs at once.

#m::
Run Notepad
Run www.yahoo.com
Run Calculator
Run www.google.com
return

The above script will open the notepad, calculator and the home pages of both yahoo and google as soon as you press the Windows+m keys on your keyboard. Since AutoHotKeys executes scripts top-down, the programs will open in that order, so you can of course write them in order of your own preference.

The above script is an example of a multi-command line script and that is why we have put the commands beneath the hotkey definition. This improves readability and makes it easier to modify the scripts later, especially for larger scripts.

The Return command will exit the script (you will understand its real importance later). In single-line scripts, using the return command was unnecessary as exit was implied.

Let’s see another variation of the above script:

#m::
Run Notepad, , max
Run www.yahoo.com
Run Calculator
Run www.google.com, , min
return

Now when you use this script, the Notepad will open maximized on your screen, while the google browser window will be minimized.

Meghna

AutoText Script - Expanding abbreviations with AutoHotkey

Tuesday, August 12th, 2008

This is the day and age of abbreviations, thanks to IMs and SMS. While academicians worry about its adverse effects on the English language, you should be worrying about its effects on your career.

It may be acceptable to type BTW, IIRC, FYI etc. in the virtual world, but it’s not looked kindly upon in the corporate world, and I am sure all of us have some time or the other made the mistake of using these abbreviations in our official emails.

Now you can of course choose to attend the email etiquette classes conducted by your organization or be smart about it and do what I do.

A simple AutoHotKey Script will fix this problem.

::BTW::By The Way

::IIRC::If I remember correctly

::FYI::For your information

To learn how to use these scripts, click here

Whenever you type these abbreviations, they will automatically get expanded, and in every application you use. Cool, right!

And the best part, you do not need to make a different script file for each abbreviation. You can just put all the abbreviation scripts in one and keep adding to them as and when you require. Just compile and run the file after each change.

Have Fun!!

Meghna

AutoHotkey script; Launch Google

Monday, August 11th, 2008

Let’s admit it; we all spend a lot of time googling whether it be for personal reasons, professional reasons or just for fun. So this simple script is probably the most useful one you will ever come across. (It is definitely my favorite, so maybe I am biased).

#g::Run www.google.com

To know how to create a script file, click here: First AutoHotkey Script

How It Works:

The # symbol denotes the Windows key.

:: symbol means that the action defined on its right will be executed when the hotkey defined on its left is pressed.

Run command is used to launch a program, in this case, the google web page.

So, when you press the windows key and the letter ‘g’ on your keyboard simultaneously, it will launch the google web page in a new window/tab.

You can of course personalize the hotkeys according to your preferences.

Meghna