Download PDF manual - Macro Scheduler

Transcript
41
Macro Scheduler
3
Scripting Windows For Beginners
3.1
Introduction
Macro Scheduler provides a simple but powerful language for automating Windows applications.
This language is similar in many respects to the BASIC programming language. As well as the
usual programming constructs it provides specialised commands for automating Windows
applications at the user interface level, such as sending keystrokes, mouse events and activating
windows.
This guide works through a simple automation example. The scenario is a rather pointless "Hello
World" type of situation, but it will work unmodified on any Windows PC and aims to demonstrate
key methods used in almost every other automation scenario, and to introduce a number of
important script elements.
You can watch a video version of this tutorial here:
http://www.mjtnet.com/demos/tutorial.html
3.2
Requirements
This document assumes you are running Macro Scheduler 6.0 or above on a standard PC running
Windows 2000 or above with a default printer enabled. You should be familiar with the Windows
operating system. Some basic programming experience is helpful but not essential.
3.3
The Problem
We need to build a script, which opens Notepad, writes a few lines of text, saves the document with
a given name and prints it to the default printer before finally closing Notepad. We will look at some
of the issues that could crop up – for example what to do if the file already exists and different
methods of dealing with this.
3.4
Using Macro Scheduler
This guide is concerned with introducing script development and does not concern itself too much
with using the Macro Scheduler interface. Refer to Using Macro Scheduler 2 for a tour around the
Macro Scheduler interface.
However, we will assume that you are using the Macro Scheduler editor to build the example script
here. Do the following to create the macro and start editing:
1.Double click on the Macro Scheduler icon in your system tray.
2.Select "New Macro" from the File menu.
Double click on the gear icon to view Macro Scheduler's control panel.
Select File/New Macro from the main menu or click the New toolbar button. This will open an empty
new macro and put you directly in the Script Editor 4 .
While in the editor pressing F1 will display the help topic for the command on the current line or the
highlighted command. There is also access to the useful command locator, which makes finding the
function or command you need easy. Help is also available from the command locator. Just press
© 2015 MJT Net Ltd