How To Use Macros
This topic discusses macros. Macros automate procedures in Collect! making it possible to phenomenally increase the speed of
execution when changes need to be made to a large volume of records.
You should have a thorough understanding of what you wish to accomplish and the steps you need to take. Please ensure
that you have a recent Snapshot of your database before running a macro that might affect volumes of accounts.
Introduction
A macro is simply a greatly sped up sequence of steps. When a macro is created, the series of steps is recorded. When the macro
is executed, it runs automatically, making whatever changes you recorded in the macro's steps. So, before you record your macro,
you will have to step through the procedure you want to automate, so that you know each step that you will be recording.
Always take a Snapshot of your database before running macros.
How To Record A Macro
You can record up to 1000 events in a macro. Each event is a keystroke or mouse movement.
KEYSTROKES
Before you record your macro, practice stepping through the procedure that you want to automate, so that you know all the
steps that you need to perform. Try to use the keyboard, rather than the mouse, whenever possible to perform each step.
If you do not know the keystrokes to perform certain functions, please refer to How to Use the Keyboard Shortcuts for
information.
MACRO COMMANDS
When you are recording macros, there are a number of commands and options you can use.
Record: | Shift+F1, R |
Stop Recording: | Shift+F1, S |
Delete Keystrokes: | Shift+F1, D |
Clear: | Shift+F1, C |
Load File: | Shift+F1, L |
Call File: | Shift+F1, U |
Repeat until you hit a key: | Shift+1, R |
Repeat to end of list: | Shift+F1, E |
Prompt for input: abort | Shift+F1, A |
Prompt for input: enter field information | Shift+F1, F |
Prompt for input: enter other information | Shift+F1, I |
Pause for key: | Shift+F1, W |
Wait Time | Shift+F1, T |
Save macro to disk: | Shift+F1, S |
Each one of the macro commands is explained below.
MACRO MENUS
If you would rather use menu options rather than keystrokes, pull down the Tools menu and choose Macros to begin
working with macros. When you are recording the macro and the blue RECORD message is visible in the upper right hand
of the Collect! screen, pull down the Tools menu and choose Macros again to display a different menu that can be used
for more advanced editing of macro options.
Record Macro
To start recording:
1. Press Shift+F1, R
2. The RECORD indicator will show at the top right of the screen.
3. Every stroke that you hit will be recorded until you stop recording. Press the keystrokes you want to record in EXACTLY
the sequence you want recorded.
4. Press Shift+F1, S to stop recording. The RECORD indicator will be extinguished.
Stop Recording Macro
To stop recording:
1. Record ALL the steps of your macro.
2. Press Shift+F1, S
3. The RECORD indicator will be extinguished.
If you want to save this macro to a disk file, you must use the save macro command after completing your recording.
Delete Macro Keystrokes
To delete keystrokes:
Press Shift+F1, D
This command deletes all keystrokes up to and including any prior macro command entered.
Clear Macro From Memory
When you record a macro, it is saved in memory until you exit out of Collect!.
To clear the macro in memory:
Press Shift+F1, C
Load Macro File
To load another macro file and add it to the end of the current macro being recorded
1. Press Shift+F1, L.
2. Select the file you want to load.
3. Press Enter to load the macro.
4. Press Escape to cancel loading the macro.
Call Macro File
To call another macro file from within this macro:
1. Press Shift+F1, U
2. Select the sub-macro file you want to play.
3. Press Enter to play the sub-macro.
4. Press Escape to cancel playing the sub-macro.
When the sub-macro has finished running, you can continue to record this macro.
Repeating Macros
The power of macros lies in the ability to repeat the steps that you are recording. So, you go through all the steps EXACTLY
while recording them, then choose a repeat command. Then Collect! can automatically process large volumes of records by
repeating these same steps as long as there is data to process or you choose to stop the macro.
REPEAT UNTIL YOU HIT A KEY
To repeat until you hit a key:
1. Record ALL the steps of your macro.
2. Then, press Shift+F1, R
3. This will end the recording session. When the macro is run, it will continue to repeat the steps that you recorded, until you
press a key.
REPEAT TO END OF LIST
To repeat until the end of a list is reached:
1. Record ALL the steps of your macro.
2. Then, press Shift+F1, E
3. This will end the recording session. When the macro is run, it will repeat to the end of the list that it is processing.
Macro Sequence When Repeating
When you are recording a macro, and this macro was called from some other macro, this macro will return control to the calling
macro after completion of its task.
If this macro is aborted with a keystroke, control will not be returned to a calling macro.
Prompting For Input In Macro
Getting input while a macro is running.
CONTINUE OR ABORT
To optionally continue or abort a macro at some point:
1. Record all the steps of the macro up to the point where you want to prompt for input.
2. Then, press Shift+F1, A
3. When the macro is running, you will be asked if you want to continue the macro from this point.
If you enter "y" for Yes, the macro will continue from this point on, playing any keystrokes or commands you recorded after
this point.
If you enter "n" for No, the macro will abort here.
4. See Macro Sequence When Repeating (above).
ENTER INFORMATION INTO FIELDS
To enter information into fields at some point:
1. Record all the steps of the macro up to the point where you want to prompt for input.
2. Then, press Shift+F1, F
3. When the macro is running, you will be able to enter unique information into fields at this point.
ENTER OTHER INFORMATION
To enter information (not necessarily into a database field) at some point:
1. Record all the steps of the macro up to the point where you want to prompt for input.
2. Then, press Shift+F1, I
3. When the macro is running, you can get input at this point.
Pause For Key In Macro
To cause a running macro to pause at a specific point until you hit a key:
1. Record all the steps of the macro up to the point where you want to pause.
2. Then, press Shift+F1, W
3. When the macro is running it will stop here until you press a key.
Wait Time In Macro
To cause a macro to wait for a specified length of time at some point:
1. Record all the steps of the macro up to the point where you want to wait.
2. Then, press Shift+F1, T
3. Enter the length of time to pause, and press Enter.
The time is measured in milliseconds (1/1000th of a second), and the minimum time you can pause is 1/18 second
(the timer tick rate of your computer).
4. When the macro is running, it will pause here for the length of time you specified.
Save Macro
Macros are saved in memory and can be run while you are still signed into Collect!. If you intend to use this macro in the
future, you may want to save it to disk.
1. After you have completed recording all the steps of your macro, stop recording either by pressing Shift+F1, S or by choosing
one of the repeat commands.
2. Then, press Shift+F1, S
3. Type the name of your macro and press Enter. The file will be stored with a .MAC extension (e.g. filename.mac) in your
Collect\bin directory.
How To Run A Macro
Always take a Snapshot of your database before running macros.
After you record a macro, it is stored in the computer's memory, and can be played back while you are still using Collect!
When you exit from Collect! the macro is not saved. To save a macro, see above.
Playback Macro
To play back the recorded macro:
Press Shift+F1, E or press Alt+F2.
The program will play back your recorded macro, replaying the keystrokes or mouse actions exactly the way you recorded them.
Load And Run Macro
To load and run a macro that you saved to a disk file:
Always take a Snapshot of your database before running macros.
1. Navigate to the screen in Collect! where you want to run the macro.
2. Press Shift+F1, P
3. Select the file you want to run.
4. Press Enter to run the macro.
5. Press Escape to cancel running the macro.
Load Macro Without Running It
To load a macro file into macro memory without running it:
1. Press Shift+F1, L
2. Select the file you want to load.
3. Press Enter to load the macro.
4. Press Escape to cancel loading the macro.
Delete Macro File
To delete a macro file from disk:
1. Press Shift+F1, D
2. Select the file you want to delete.
3. Press Enter to delete the file.
4. Press Escape to cancel deleting the file.
Stop A Running Macro
You can stop a running macro, at any time, by pressing the Escape (Esc) key on your keyboard.
Run Macro When Collect! Starts
Using Command Line Startup Option /a, you can cause a macro to run as soon as Collect! starts. To do this, you
should also use Command Line Startup Options to sign into a database automatically.
Create your macro to run from the Main Menu or Work In Progress, that is, the screen you usually see when you sign into
Collect!. Save your macro. Then modify your Collect! Desktop icon as follows.
Icon Shortcut Target:
Collect\bin\cv12.exe /iOWN /pOWN /dbmasterdb /amymacro.mac
/i is the Operator ID
/p is the Operator Password
/db is the database you are signing into
/a is the name of the macro you are running automatically on Startup.
|
Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.
Please click this link to send us your comments: helpinfo@collect.org