While this section talks about directly interacting with the script objects, note that you can execute VBScript or Javascript at any point using any of the available Run*Command functions. using your existing script assets in this fashion and mixing with IronPython code for new functionality as needed is a viable and option.
Access to the application scripting objects is provided via the predefined oDesktop object (as listed in Script Objects). Interacting with the script objects is very natural, method calls are made just like in VBScript except that the argument syntax is somewhat simplified to follow natural Python syntax. All primitive types (string, integer, double) map to the natural primitive types in python. The only differences from the VBScript syntax are seen when specifying array type arguments. The differences are described in earlier chapters.NoteThe typical VBScript calls to obtain the registered COM scripting interface via CreateObject calls and then obtain the oDesktop object from it using the GetAppDesktop() is not needed (or even supported on all platforms). Since all scripting occurs in the context of a running workbench, the available Desktop object is always provided and expected to be used directly.
Scripting using the IronPython scripting API is very much like scripting with VBScript except that
Any argument is supplied via the builtin ScriptArgument variable
The oDesktop object is always available
The scripting method names are identical to the ones used with VBScript
Method calls, while the name is the same have to adhere to the rule of ensuring trailing parentheses irrespective of whether the function returns anything or has any arguments.
Any compound/block arguments should be translated to the appropriate IronPython array or dictionary syntax.
The samples appendix lists a collection of pure IronPython snippets: these, along with the various script snippets listed in this document should serve as a guide and reference.