Instance opening script is executed for every new workflow instance when initiated. This script may be useful to assign dynamically changing default values. (ex: assign current date to form value)
In script you can use $Instance to get or set initiated instance properties, $Initiator variable specifies who initiated the workflow instance, but variable can be null for the module type tasks. You can also refer to right panel to list available scripting objects.
Unlike task prework or postwork scripts $Xml variable is attached to the data model root element, not to the pool element.