Back to previous pageReturn to Tutorials index



Automate system tasks in Windows (2)
Free backup is finally here.  Mozy Remote Backup.
Speed up any part of Windows by automating repetitive tasks using both the Scheduled Tasks tool (XP only) and a free automation tool (all versions of Windows). Part two of two

Click here for part one

I
n part one of this tutorial we revealed how to use the Scheduled Tasks utility in Windows XP - different versions of Windows work in a different way, so consult the Help file for details.
 
   When it comes to automating specific tasks within a program, you should use AutoHotKey. It works in a similar way to Microsoft Office - it can record your mouse clicks and keystrokes with the help of a built-in tool called AutoScriptWriter. Unlike Office, because AutoHotKey is designed to work across Windows  and all Windows-based programs, it's a less exact science, so care is needed.
 
   The key difference is that AutoHotKey records the mouse in a different way to Office - it doesn't record what you've clicked on, but merely records where the mouse is on your screen and that you've clicked it. When the macro is run again, it merely puts the mouse where you placed it originally and clicks. This is fine if the window or dialog box stays in the same spot, but if it moves for any reason your macro is rendered useless.
 
   Thankfully you can control any program via the keyboard, and although there's a small period of adjustment you'll find that not only will your macros work every time, but you'll find shortcuts to speed up the way you use Windows too.




Plan your macro
Start by examining your program using the mouse to help you. Locate the options and dialog boxes you wish to incorporate in your macro and see if there are any keyboard shortcuts that could open the required box quickly - for example, to check your mail in Outlook Express, press [Ctrl] + [M].
 
   Even if a shortcut doesn't exist, you can browse to the item quickly using keys: look at the menus at the top of the screen and you'll see one letter in each is underlined. If you press [Alt] + that letter (for example, V for View) you'll open the menu. You can then press the underlined letter of the option you want - P for Print Layout perhaps - or you can use the cursor keys to manually select the item in question. This way you can access any menu item without a mouse.
 
   It's a similar process when navigating dialogue boxes. Look for an outline around a tab or dialog box - this is the currently selected box - and use [Tab] and [Shift] + [Tab] to move between boxes. If you need to select a different tab, select the first tab using [Tab] and then use the arrow keys to move between tabs.
 
   When a box is selected you can type a figure into it; if it's a box, press [Space] to tick or untick it. Use the cursor keys for drop-down menus or to select a different radio box. To click OK when you're done, simply press [Enter].
 
Create your macro
Macros can be used to launch programs and then perform a specific action, but they can also be used to automate an action within a program - perfect if you want to be able to apply a group of different actions to any file with a single click or keypress.
 
   Once you've rehearsed the moves you wish to perform, you're ready to record the basic actions of your macro. Download and install AutoHotKey from here, and use the step-by-step guide to help you get started with the AutoScriptWriter component.


Step-by-step: Create your first script in AutoHotKeys


After you've saved your script, what next? The box reveals how to fine-tune your script with the help of the program's comprehensive Help file. When you want to use the macro, double-click the file and an H icon will appear in the Notification area of the taskbar. You can run the macro simply by double-clicking this or using a keyboard shortcut you've created; alternatively convert it into a standalone program file that runs independently of AutoHotKey using the Ahk2Exe program, which is included with AutoHotKey.



Edit your macros

Click here for part one






All content copyright © Support PCs and the original authors