API example: The first lines of a script

The following template is a suggested starting point for using the Synergy API with VBScript bindings.

It is good practice to put explanatory comments at the top of your scripts.

The following five lines and their function is outlined.

Option Explicit

The Option Explicit expression is useful to reduce programming errors. Variables that are used before they are declared will cause an error when this line is included in the script.

SetLocale("en-us")

The SetLocale option forces the non-English systems to interpret numerical values as they are in the US. If this setting is not included, then numerical values will be interpreted in the system's native language. This is a problem where commas are used instead of full stops (such as in Germany).

Dim Synergy
Set Synergy = CreateObject("synergy.Synergy")

These two lines create an OLE automation object which starts the version of Synergy (the Autodesk Simulation Moldflow user interface) that was most recently executed.

Note: only one version of Synergy is able to be run at any time.
Synergy.SetUnits "METRIC"

"ENGLISH" can be used as an alternative to "METRIC" to use US units by default.

'@
'@ DESCRIPTION
'@ 
'@
'@ SYNTAX
'@ TheFirstLines
'@
'@ PARAMETERS
'@ none 
'@
'@ DEPENDENCIES/LIMITATIONS
'@ none
'@
'@ History
'@ Created DRA 9/8/2006
'@@ 
Option Explicit
SetLocale("en-us")
Dim Synergy
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "METRIC"
'
' Put remainder of code here.
' 
MsgBox "Script Complete"
Wscript.Quit