User macro-commands

 

 

BENE: update menu items / shortcuts

In Ellié Computing Merge, we decided to integrate a full ECMAScript engine to let you make your own macro-commands.

Defining macros

The "User" macro commands are ECMAScript functions. These functions are listed in the "macros" global Array object. Thus, adding a function to this array makes it available as a macro command in the Edit / Macros menu (it appears after next Reload macro files, Alt-F11 by default).

In order to make this possible, Ellié Computing Merge loads and execute macro scripts at start-up (and also at Reload macro files time).

When a macro script is executed, it simply declares some macro as available in this way:

macros["macro_name"] = function ( ) {
    // body of the macro
    alert ("I was executed at " + Date());
}
macros["macro_name"].label = "Beautiful Macro name";
macros["macro_name"].shortcut = "Ctrl+Shift+0";
macros["macro_name"].toolbar_name = "My macros";
macros["macro_name"].toolbar_rank = 1;
macros["macro_name"].icon_url = script_url.compose("../myicon.png");

You can save the above sample in the 'macros' directory of Ellié Computing Merge as 'sample_macro.js', then execute Reload macro files. The "macro_name" macro appears in the macros menu, executing it will display the famous web-browser alert box with "I was executed at [current date and time]" text inside. Two menu items Open Macro folder of / Users or Application are provided so you do not have to search those directories on disk.
Macro files are loaded in alphanumeric order and numeric order where applicable (i.e. file10.js loads after file2.js).

Accessing macros from Graphical User Interface

Macros are accessible from: