Home Forums General XMetaL Discussion Disable Drag&Drop for Images in XMAX Reply To: Disable Drag&Drop for Images in XMAX

Derek Read

Reply to: Disable Drag&Drop for Images in XMAX

The documentation for all of the customization files supported by XMetaL software (all three editors) is included with XMetaL Developer in the Programmers Guide and the Customization Guide.

When using XMetaL Developer to create an MCR file you start with individual script files (in any scripting language you have a scripting engine installed for, but most often JScript or VBScript) and XMetaL Developer then compiles those into an MCR file when you build your project.

If you don't have XMetaL Developer but do have access to an installation of XMetaL Author Essential or Enterprise there are lots of MCR files included in those installations you could use as examples.

The MCR file format is a simple XML structure containing multiple macros. Each contains a separate script and some metadata that identifies the script language, gives the macro a name, a keyboard shortcut and a few other pieces of metadata that are not really useful for XMAX usage but that may come into play with XMetaL Author Essential or Enterprise.

Here's the simplest of examples of a file containing 2 macros:

//use JScript to display an alert dialog containing some text
ActiveDocument.Host.Alert("This is test 1");

'use VBScript to display an alert dialog containing some text
ActiveDocument.Host.Alert "This is test 2"

In the case of Addam's suggestion you would use name=”On_Drop_Files” for the macro name. When the macro's name matches an event macro's name (as documented in the Programmers Guide) it fires when that event is triggered.

All other macros are effectively “user triggered” (vs “event triggered”). In the case of XMetaL Author Essential and Enterprise a dialog is available that lists all macros and the user can select one to run, or the user may use a shortcut key to trigger the macro (if defined, which in my example is not the case). XMAX does not provide this type of UI so it would be up to you (as a developer) to expose something like this to the user from your application's own UI. Your code would call XMAX's Run method (see the Programmers Guide) and specify a macro to run. The API method named “Run” can be used to run any macro (in all three editors).