Triggers: QM events

Launches the macro on certain Quick Macros events. To assign this trigger, use the Properties dialog.

 

Startup

These events occur when QM starts, or when this QM macro list file is loaded or reloaded. If "Run synchronously" is checked, the function runs before any other macro can start. Functions that run synchronously must not contain wait commands, or QM will start with a delay. The _command variable is "1" on file change, "2" on QM startup, "3" on Windows startup (QM started with command line parameter S). These events can occur in this sequence: file loaded, QM started, Windows started.

 

There is another way that can be used to execute code or declare something when QM file is loaded. Create function init2 and place the code there. Function init2, if exists, is called even before "File loaded" triggers. It is called by the init function which is in the System folder and is called by QM to initialize QM extensions.

 

Exit

These events occur before QM exits, or before unloading or reloading this QM macro list file. The function runs synchronously and must end as soon as possible. The _command variable is "1" on file change, "2" on QM exit, "3" on Windows shutdown/restart/logoff. These events can occur in this sequence: Windows exits, QM exits, file unloading.

 

Tray icon

These events occur when you click the QM tray icon. These triggers disable default QM actions (show QM on left click, exit QM on Ctrl+left click, show menu on right click, disable/enable on middle click).

 

Trigger management

Used by user-defined triggers.

 

Add to a menu

QM items that have this trigger are added to the QM menu bar, to the New menu, or to the tray menu.

 

QM 2.2.0. Menu bar triggers launch the macro with two arguments, which are x and y coordinates where popup menu should be displayed.

 

QM 2.2.0. For macros and menus that have menu bar trigger, you can include & character in macro name. Then next character in menu bar will be underlined, and you can use the keyboard to show the menu.

 

File link run (QM 2.3.0)

Run when a QM item of type file link is launched. To run only for certain file types or files, specify a filename pattern. Can be used wildcard characters * (matches 0 or more characters) and ? (matches any single character). When you assign the trigger using the Properties dialog, it inserts code that provides file link item id and its file path.

 

End thread (QM 2.3.0)

Run when the user tries to end a thread in the Threads dialog or in the Running Items list. If the function returns 0, QM does not end the thread. The function, for example, can display a warning message box, or just silently deny the user's request, or correctly end the thread in a special way.

 

QM show/hide (QM 2.3.3)

QM show: Run when QM window is shown. For example, on tray icon click.

 

QM hide: Run when QM window is hidden. For example, on X button click. Not on QM exit.

 

Recording ended (QM 2.3.3)

Run when recording ends, except on Cancel. Must be function. Receives recorded macro, and can change it. For example, add header/footer, change window names.