|
Running scripts at start-up
Ellié Computing Merge can run scripts at start-up in graphical user interface as well as from command line. Scripts are run before the initial document is loaded and/or after the initial work is done (loading the initial comparison, and realizing export command if any) and after the GUI is displayed in GUI mode. Syntax ecmerge(.exe) --script="myscriptfile.js" --script-text="my_function('with', 'some', 'parameters')" --pdl-script="mypdlscriptfile.js" --pdl-script-text="my_pdl_function('with', 'some', 'parameters')" Running such a command executes mypdlscriptfile.js then call my_pdl_function with the given arguments, then executes myscriptfile.js then call my_function with the given arguments. The --pdl-?? options stands for Pre Document Loading, they are executed just before the document loads and before any merge or export operation happens. It is useful when you want your script to act on the document's options for example. Time line Here is what Ellié Computing Merge start-up executes with respect to the scripts:
Notes Note that executing a script containing only a function declaration will actually just declare it and make it available during that execution. You will note the presence of the VFS.load_text method, coupled with the eval ( ) function of ECMAScript, you can actually load other scripts and execute them (which gives you a function similar to import of Java or #include in C/C++). If you want to run from command line (whose default is to print a textual report of the comparison), you might want to use -Xnone to avoid such generation, though the comparison will still occur. During startup, the initial_document as well as script_url variables are available in Application object. script_url is available during --script and --pdl-script only. Platforms specificities with respect to [pdl-]script-text argument:
See Also
|
|