A macro is a set of one or more actions that each perform a particular operation. Macros can help you to automate common tasks that your users perform. For example, you can run a macro that opens a custom form when a user clicks a command button.
A macro can contain a series of actions that are executed sequentially or it can contain looping structures, via the use of labels, which allow certain sections of the macro to be re-used. It is also possible to use conditional expressions to ensure that certain actions will only be executed when the specified condition is True.
The typical macro consists of a series of actions which will be executed sequentially. Newlook carries out these actions, in the same order, each time the macro runs. The only time that a macro will not be executed in sequence is in the following scenarios:
If you have functionality in your macro which you would like to re-use or isolate from the rest of your macro, then assigning a label to the start of a group of actions can be helpful.
A Label allows you to name a set of actions which correspond
to specific functionality which you want to call in the macro. When
you call a label within a macro, Newlook
executes the action in the row containing that label and any actions that
follow it until a StopMacro, StopAllMacros action is encountered or the macro ends. To run a macro from a specific
label onwards, you would specify the macro name followed by a period (.)
and then the name of the label: <MacroName>.<Label>
For example:
The following macro, named Lookup, is made up of three sections of functionality: Employees, Products, and Reps. Each section carries out the OpenFormaction, and the Products section also carries out the PlaySound action. In the example below, if you wanted to execute the macro from the label onwards (i.e. line 3 onwards) you would call the macro by specifying Lookup.Products.
Note that if you were to do this the macro would start executing at line 3 and continue executing until a StopMacro action was encountered (line 6). If you were to run the macro from the Employees label then only line 1 and 2 would execute.
If you have functionality in your macro which you only need to execute if a specific condition is met, then one way of doing this is to specify a condition against a macro action.
The following macro runs the SendKeys and the GotoMacro actions only when the expression in the Condition column is true. Use the string "..." (without the quotation marks) to indicate that the condition is the same as the line above.
For more information see About Macro Conditions.
Comments can explain a procedure or a particular instruction to anyone reading your code. Newlook ignores comments when executing a macro. Comment lines begin with an apostrophe (') and can be used in any macro statement. Specifying an apostrophe as the first character of the Label column switches that row into comment mode. The comment will extend across to the right to the last unused column. Placing a comment on a line which already has a Condition/Action defined will display the Condition/Action as green text (i.e. an indicator that this row will not be executed).
To convert an existing line
of your macro into a comment, select the relevant row/s and click the
Comment Row(s) () from the toolbar. To convert a commented row back into an executable action, click the Uncomment Row(s) (
) button on the toolbar.
To add a new row to an existing macro, position your cursor where you would like to insert the new row and click either the Insert Row Before () or Insert Row After (
) button.
To delete an existing row from your macro, select the row/s you would like to remove and click the Delete Row () button. To select multiple individual rows, hold down the CTRL key and click the index column of the relevant rows. Alternatively you can use SHIFT and click if you want to define a selection group.
Macro Conditions | Properties and Events | Variables, Arrays and Types | Expressions | Startup Macro | Macros overview | Writing your first macro | Scripts | Reference
© 2004-2021 looksoftware. All rights reserved.