Writing Zeus Macros Using Digital Mars Scripting

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2436
Joined: Fri Aug 13, 2004 5:10 pm

Writing Zeus Macros Using Digital Mars Scripting

Post by jussij » Thu Sep 22, 2005 5:51 am

Since the Digital Mars Scripting implements the Windows Scripting Host interface, this means it is also possible to write Zeus macros using the DMD Scripting language.

To setup Zeus for DMDScript scripting do the following:
  1. Make sure you are running the latest version of Zeus
  2. Download the DMDScript component
  3. Register the DMDScript WSH using regsvr32 dscript.dll
  4. Go to the Zeus install directory and edit the scriptwsh.dat file making these changes:

    Code: Select all

    [Options]
    Language=DMDScript
    Extension=ds
    MacroBegin=function key_macro()\n{
    MacroEnd=}\n\nkey_macro()   // run the macro
    FunctionPrint=\tzeus.write("%s")
    FunctionPrefix=zeus.
    FunctionPostfix=;
    Enter=\n
    CRLF=\\n
    LineFeed=\r
    Tick='
    Quote=""
  5. Close, then restart Zeus
  6. Save this test macro to the zScript\test.ds location

    Code: Select all

    function key_macro()
    {
        zeus.screen_update_disable();
        zeus.FileNew();
        zeus.write("ScriptEngine: " + ScriptEngine() + "\n" +
                   "Build: " + ScriptEngineBuildVersion() + "\n\n");
        zeus.write("This is a Digital Mars macro script........\n")
        zeus.screen_update_enable();
        zeus.screen_update();
    }
    
    key_macro()   // run the macro
  7. To run the test macro use Macros, Execute Script menu and type in test.ds
If all goes to plan the macro will create a new document window and the line of text will be added to the document.

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 2 guests