|
Below is a brief outline on using Macros in LabChart. For a more detailed explanation, see your LabChart for Windows or LabChart for Macintosh
User's Guide.
What is a Macro?
A macro is used to group a set of commands together. Macros automate repetitive
tasks that you would normally have to perform, such as changing LabChart
settings for different stages of an experiment, or setting up the Data
Pad for analysis.
How does a Macro Work?
A macro records the results of your actions step by step, then reproduces
them when played back. Macros can record almost any LabChart operation: setting
dialog box and window controls; changing the display format; copying waveform
data to the Data Pad; saving data as a new file; printing the Zoom window
display of selected data, and so on.
It is important to note that macros record the results of your actions,
not individual keystrokes and mouse clicks, and record the simplest possible
interpretation of those actions. Even if you spend time altering control
settings during the recording of a macro, only the final settings you
obtain will be used.
Macros are saved as part of a LabChart file, and are available when that
file or one of its windows is active. When a file is saved, all currently
available macros are saved with it, becoming part of the file.
How are Macros Useful in Teaching?
When using LabChart, macros can make your teaching labs easier by fully or
partly automating tasks so that students can concentrate on obtaining
data. For example, macros could be created that change LabChart settings
for different stages of a lab experiment. Students simply select the appropriate
macro menu item and LabChart is set correctly and ready for them to start
the next exercise.
Moving Macros Between LabChart Files
Ideally, macros would be part of a LabChart Settings file that you use as
a template from which to create new files. See Creating
Settings Files for more information.
However, if you want to use a macro from one LabChart data file in another
you can.
Mac
- Open the LabChart file that contains the macro you
want to use
- Choose File > Open
In the Open dialog
box choose an existing file that you want to move the macro into and
ensure that Discard Existing Macros is turned off. Click Open.
or
Choose File > New to open a new (empty) file that contains the macro.
Windows
- Open the LabChart file that contains the macro you
want to use.
- Choose File > Append
In the File Append
dialog box choose an existing file that you want to move the macro into
and click Open.
or
Choose File > New. In the New Document dialog box ensure that Settings
from Document '
adicht' is turned on. Click OK.
Tips and Suggestions
- Write down what you want the macro to do first.
Having this clear in your mind will help to avoid mistakes macros
cannot be edited in Chart (Macros are only editable in LabChart for Windows), if you make a mistake then you have to start recording
again from the beginning.
- Make a more complex macro out of very simple steps.
Since macros cannot be edited, it makes sense to break your task into
smaller macros then use another macro to use all the smaller ones.
- Macros only remember the settings you have clicked
or selected, so if a setting you require is already on, then you must
click on it once to turn it off and then again to turn it on.
- Keep a written record of the steps involved in
your macros, and their purpose its easy to forget which
macro does what when you havent used them since the last laboratory
class
Example Macros
Below are three simple examples of macros that set up LabChart, automate
data recording or automate data analysis.
LabChart Set-Up Macro
In this example you have an experiment with two stages; in stage one LabChart
samples at 100/s on two channels (Macro 1), and in stage two it samples
at 20/s on four channels (Macro 2).
Macro 1
- Select Start Recording from the Macro menu.>
- Using the Rate pop-up menu, set the sampling speed
to 100/s.
- Using the Channel Function pop-up menus, turn on
channels 1 and 2.
- Using the Channel Function pop-up menus, turn off
all other channels.
- Choose Stop Recording from the Macro menu. You
will be prompted to save the macro; save it with a suitable name, such
as 'Stage 1'.
Macro 2
- Select Start Recording from the Macro menu.
- Using the Rate pop-up menu, set the sampling speed
to 20/s.
- Using the Channel Function pop-up menus, turn on
channels 1 through 4.
- Using the Channel Function pop-up menus, turn off
all other channels.
- Choose Stop Recording from the Macro menu
Data Recording Macro
In this example you want to make one-minute recordings that are each separated
by nine minutes. You want to do this for one hour. Note: there are several
ways you could do this one method is detailed below.
- Select Start Recording from the Macro menu.
- Choose Macro > Macro Commands > Begin Repeat
and set the number of repeat times in the Begin Repeat (Mac) or Macro
Repeat (Windows) dialog box to six. Click OK.
- Click the Start button to start LabChart recording.
- In the ensuing Macro Sampling dialog box set LabChart
to stop sampling after a fixed duration of one minute and ensure that
'Finish sampling before doing other macro steps' is selected. Click
OK.
- Choose Macro > Macro Commands > Wait
- In the Macro Wait dialog box set LabChart to wait
for nine minutes.
- Choose Macro > Macro Commands > End Repeat.
- Choose Macro > Stop Recording.
Data Analysis Macro
In this example, you want to select each block in the recording, add them
to the Data Pad which will calculate the mean for all of the blocks.
- Select Start Recording from the Macro menu.
- Choose Windows > Data Pad and set up the Data
Pad so that means are calculated for the appropriate channels.
- Choose Macro > Macro Commands > Repeat Select
Each Block.
- Choose Commands > Add to Data Pad.
- Choose Macro > Stop Recording.
|