Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Opened
sales@elliecomputing.com - Contact us


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:

  • the Edit / Macros menu
  • the toolbars: if you set a property "toolbar_name" and/or "toolbar_rank" for a macro (as in the sample above), the macro will be accessible from an additional macro toolbar
    • one macro toolbar is created for each distinct "toolbar_name"
    • the toolbar_rank is used to sort macros in ascending (left to right) order in a toolbar
    • if 'icon_url' points to a local file, this image is used else a default icon is provided. We generally use 16x16 24bits PNG with transparency as icons.
  • the key bindings / shortcuts:
    • you can specify a default shortcut for any macro by defining its "shortcut" property (as in the sample above)
    • macros are visible in the "Key Bindings" panel of the Application Options, you can therefore set modify their shortcut as for any other command