Keystroke Macro commands format

 

A keystroke macro is a sequence of keystrokes (or key combinations) that can also include commands. An example of simple program that emulates a series of user’s actions..

1. Format of a keystroke macro definition

Start / end symbols.

 

<|

Starts a keystroke macro definition (always in the beginning of the string).

|>

If a keystroke macro is being defined, end the definition.

 

To start defining a macro, type <|, When you are finished, type |> to terminate the definition.

E.g., key combination Ctrl-A can be defined as:

<|'1'|0| VK_CONTROL, 'A', VK_CONTROL |>

 

Where:

'1'

Key shortcut that starts a keystroke macro.

Ten shortcuts are available at the moment:  0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

 

|0|

An index that shows the selector state at which the keystroke macro

    is available.

|0| - no item selected

|1| - item(s) is selected

|2| - selected items are in drag

 

VK_CONTROL

(First entry)  - Ctrl-key: Down

 

'A'

'a' – key:  Down + Up

 

VK_CONTROL

(Second entry) - Ctrl –key: Up

 

For the complete list of virtual key codes see  Macros\VirtualKeys.txt.

 

Modifier keys.

 

Modifier keys: VK_CONTROL, VK_SHIFT, VK_MENU, VK_LWIN, VK_RWIN, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU.

 

A natural rule for modifier keys:  odd key entry - Down, even key entry – Up

 

For example keystroke Ctrl-C,

<|'1'|0| VK_CONTROL, 'C', VK_CONTROL |>

 

See Macros\VirtualKeys.txt

 

Repeat count.

 

Repeat count for the current virtual key.

E.g.,

<|'1'|1| VK_TAB(3) |>

 

can be used instead of

<|'1'|1| VK_TAB, VK_TAB, VK_TAB |>

 

Multi-string variant.

 

<|'1'|0|

VK_CONTROL,

'A',

VK_CONTROL

|>

 

Comments.

 

//

The same as single-line comment in C++ // (two slashes) characters,  followed by any combination of characters.

E.g.,

Variant 1:

<|'1'|0|

VK_CONTROL, 'A', VK_CONTROL,   // Ctrl-A (select all)

|>

 

Variant 2:

<|'1'|0|

////////////////////////////////////////////////////////////////

//    Description:  - select all                                                         //

//    Requirements: -                                                                      //

//    Shortcut key: - '1'.                                                                  //

//    Selector state:  no item selected (0).                                  //

////////////////////////////////////////////////////////////////

 VK_CONTROL, 'A', VK_CONTROL,         // Ctrl-A (select all)

|>

 

2. Macro Commands

Commands in the selector keystroke macro language in alphabetical order.

 

ActivateHandle

 

Activation (selection) of the the handle associated with the current keystroke macro.

E.g.,

<|'1'|1| ActivateHandle |>

 

 (See sample N9 "Activate handle" in Macros\MacroSamples.txt.)

 

ActivateHandleByName( "HandleName" )

 

Activation (selection) of the handle using a name.

E.g.,

<|'1'|1| ActivateHandleByName("MoveZ") |>

 

(See sample N10 "Activate handle by name" in Macros\MacroSamples.txt.)

 

CopyToClipboard(  "string" )

 

Copy a string to a clipboard.

E.g.,

Variant 1:

<|'1'|1| CopyToClipboard("string") |>

 

Variant 2:

<|'1'|1| CopyToClipboard(PREDEFINED_STRING) |>

 

Where PREDEFINED_STRING one of:

 

ActiveDrawingPath        - path to active drawing

ActiveDrawingName     - active drawing name

ProfilesPath                    - path to \GCtrlProfiles

ProfilesPathForwardSlash - path to \GCtrlProfiles

LocalMenuItems            - list of selector local menu items

AllMacros                        - list of loaded macro

AllHandles                       - list of selector handles (for debug purpose)

SelectedGraphics           - list of selected graphics (for debug purpose)

SelectedGraphicsVert   - graphics with vertices (for debug purpose)

VirtualKeyCodes             - Virtual Key Codes

 

(See sample N16 "Generate reports" in Macros\MacroSamples.txt.)

 

LocalMenuExec( Menu_ID )

 

Execute the local menu item with ID = Menu_ID.

E.g.,

<|'1'|1|

LocalMenuExec(107)          //  107 - 3D selector properties dialog

|>

 

A  complete list of menu IDs can be obtained with the command CopyToClipboard( LocalMenuItems ).

Command CopyToClipboard( LocalMenuItems ) puts out a full(/complete) list of menu IDs.

(See sample N8 "Local menu 'Selector 3D properties'." in Macros\MacroSamples.txt.)

(See sample N16 "Generate reports" in Macros\MacroSamples.txt.)

 

SetFocus

 

Sets the focus and bring TurboCAD window to top.

E.g.,

<|'1'|1| SetFocus |>

 

(See sample N3 "File Save As BMP." in Macros\MacroSamples.txt.)

 

Sleep( time in milliseconds )

 

Suspends the execution of the current keystroke macro until the time-out interval elapses.

E.g.,

<|'1'|1| Sleep(1000) |>

 

(See sample N6 "'Hello world!' in MS Word." in Macros\MacroSamples.txt.)

 

Str( "string" )

 

This command replaces the sequence of virtual keys.

E.g., the sequence:

 

'M', 'S', 'P', 'A', 'I', 'N', 'T',

 

can be replaced with the single command

 

Str( "mspaint" )

 

(See sample N5 "Create a screenshot and copy to MS Paint." in Macros\MacroSamples.txt.)