Hints for writing VBScript scripts

Navigation:  Advanced Formatting > Scripted Formatting >

Hints for writing VBScript scripts

Previous pageReturn to chapter overviewNext page

The sample scripts are all written in VBScript (just because eaDocX is written in VB.net, and at eaDocX we're not very good at 'curly bracket' languages..)

Here are a few tips for creating VBScripts in EA, for use as eaDocX mini-generators:

Use the supplied samples from the eateamworks.com website as a pattern

Test your script by copy/pasting some hard-coded GUIDs into it, and testing the logic inside the EA Script debugger. Only when this work OK should you remove the hard-coded GUIDs and process the ones passed by eaDocX from EA

Scripts in Ea seem very sensitive to things like having the name of the script as the last line of the script. Don't know why....

If you want to use the parameters directly in your output HTML, make sure you put parameterName.toString() otherwise the script will produce an error

Use the EA debugger to see what your output HTML looks like, and view it using a web browser. This isn't a guarantee of success, as when the HTML is passed into Word by eaDocX, Word does some funny stuff with it. Sorry, but we can't make the debugger work when you're using the scripts from within eaDocX.

Don't worry about putting the <style> definitions in your HTML: eaDocX will do that for you.

The examples don't have much, if any, error checking code. You'll need to add more, if your Scripts are to be reliable.

If you put line-feeds after each line of HTML, and indent it sensibly, this makes it easier to debug your HTML.

For more details on writing EA Scripts, and using the debugger, see the Sparx website