Writing Zeus Macros Using Digital Mars Scripting
Posted: 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:
To setup Zeus for DMDScript scripting do the following:
- Make sure you are running the latest version of Zeus
- Download the DMDScript component
- Using an admin command line prompt, register the DMDScript WSH using this command:
Code: Select all
regsvr32 dscript.dll
- Go to the Zeus install directory and create or edit the scriptwsh.ini file found here:
Th contents of that file needs to be replaced with the following changes:
Code: Select all
C:\Users\<User ID>\AppData\Local\Programs\Zeus\scriptwsh.ini
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=""
- Close and restart Zeus
- These INI file changes modify the behaviour of the scriptwsh.dll scripting module. To check these changes have been applied use the Options, Editor Options menu, select the Scripting panel and selected the scriptwsh.dll module, which should indicate the settings have been loaded as shown below:
- Save this test macro to the zScript\test.ds file 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
- To run the test macro use Macros, Execute Script menu and type in test.ds