Advancedcommands
From Autodrive
This chapter shows how to create advanced commands. Below are a few examples on aspects opening up for programming advanced commands in Java and JavaScript. Only imagination limits its use.
Plain scripting language usage
SCRIPT:javascript var s = 'Plain javascript string variable'; ENDSCRIPT
Error handling
SCRIPT:javascript try { var s = 'Plain javascript string variable'; } catch (err) { // do something } ENDSCRIPT
Calling Java class
SCRIPT:javascript importPackage( Packages.dk.autodrive.util ); ResultWriter rw = new ResultWriter(); rw.println("Test message to default result.txt file in the root of the project"); rw.close(); ENDSCRIPT
Calling plugin
/* * theObj exposes all public methods on the plugin, see javadoc */ SCRIPT:javascript importPackage( Packages.dk.autodrive.base ); importPackage( Packages.dk.autodrive.plugins ); var f = ''+at.loadJS("stdfunc.js"); eval(f); theObj = getPlugin(Packages.dk.autodrive.plugins.ATF_Webservice_Commands); ENDSCRIPT