Macro > Content >

General Macro

General macro allows user to create a macro that:

Inserts a plain text (similar to text macro but just plain text, no rich content)
If macro content only contains a text like "Hello, world!" and this macro is executed then all what happens is that the text "Hello, world!" is inserted to the application in what the macro was started. It can be configured if the text is inserted through clipboard (copy text to clipboard and then paste it in the application) or as a sequence of keystrokes (mimic keyboard).

And/or executes various macro commands to manipulate mouse, keyboard, files, windows, clipboard, variables, registry, etc. It is typical that macros consist from both plain text to insert and macro commands. For example, the macro can look like this:
"Hello, <wx>(1000)world!"
Such macro when executed inserts text "Hello, ", then it waits for one second and then it inserts text "world!".



There are some examples:


Sample macro


What the macro produces when played back (for example, in Notepad)















The macro can be created by clicking on the "Add General Macro" button as shown here:



Steps vs. Code


It is possible to view and edit macro in two modes: Steps and Code. Does not matter what editing mode user uses, the macro always does the same thing. It is possible to switch between these two modes any time using a tab shown on the figure below.


If "Steps" is selected then the macro is displayed as a formatted sequence of steps. The macro steps can be added, deleted, copy/paste, dragged and dropped....


If "Code" is selected then a plain macro text with its specific commands syntax is displayed. In this case the macro can be edited as a text. It is not needed to know the macro commands syntax to add a new command - when < is typed then a list of available commands is showed to pick from.


Run Macro


One of the way how to execute macro is by clicking on "Run Macro" button in the toolbar:



It is possible to run just selected steps of the macro. This can help with development of bigger macros. To run just a subset of macro steps do this:

1.Select steps (click on them holding down "Ctrl" key). When the steps are selected then release the "Ctrl" key.

2.Then press "Alt" key and hold it pressed.

3.Click on "Run Macro" icon.


Adding Command


Commands can be added to the macro by clicking on "Add Command" toolbar button or by hitting "+" key on numeric pad.



If in "Code" mode, of course, the macro is edited as a plain text and macro can be typed the same as any other text.


Macro Recording


Macro recording can be started by clicking on "Record Macro" button:


See more about macro recording.


Command Editing


A command editor can be open by clicking on "Edit Command" toolbar button or by double-click on the command.



Macro debugging


Macro can be executed step-by-step and content of the variables can be inspected during the debugging. Click on "Start debugging" to enable other debugging operations:



Go to debug break
There is "Debug BREAK POINT" (<-dbp->) macro command that can be put in macro as a point where to postpone debugging. This helps to quickly get to certain step in the macro instead of getting there step by step.

Go to cursor position
During debugging it is possible to navigate to other macro step/command and select it (move cursor and click).  This operation then runs the macro until it reaches the selected step/command. 

Show command to execute
If during the debugging user scrolls to other step/command and selects it then this operation jumps back to the macro step/command that will be executed next. 

Show variable content
This operation displays a window that shows macro variables current value.

Stop debugging  
Terminates debugging.




It is possible to search in macro for a text occurrence:



The Macro Toolworks searches in the text that is displayed based on Steps or Code mode. This means that for example if user searches for the <run> command occurrence while having Steps mode selected nothing will be found (because <run> command is in Steps mode displayed as more descriptive "Run MACRO").


Macro validation


Macro text is automatically validated. If a suspicious syntax is detected then a warning icon is highlighted and enabled. Warnings detected can be displayed by clicking on the icon.



Comment Out


It is possible to comment out a selected part of the macro (one or more commands). The comment out part of the macro is not executed. It is possible to uncomment the block again - just select portion of the commented block and click toolbar button.




Using Clipboard or As Keystrokes


As it was said, the general macro inserts plain text (such as "Hello, World!"). There are two ways how the text can be inserted:


1.Using Clipboard
The macro text is copied (similar to Ctrl+C) to the Windows clipboard and then pasted (similar to Ctrl+V) in the other application.

2.As keystrokes
The macro text is sent to other application as a stream of keystrokes the same as when user types it on keyboard.

It can be selected for each macro which option should be used:


If the "Default" option is selected then the option is the one that is defined in the program settings.


On Error


It is possible to define what should happen when a macro command fails:



Read here more.