Session
DocOrigin Inter-process Communication
(As of 3.1.002.10)
DocOrigin maintains an internal mechanism for passing information between various DocOrigin programs that are being spawned internally or explicitly using the DocOrigin scripting functions. This mechanism is called Session.
A Session is any chain of DocOrigin programs that run to completion. Such as when using FolderMonitor to spawn Merge to generate a document. Or RunScript calling Merge, or perhaps other DocOrigin tasks. The Session mechanism provides an alternate way to pass data between these DocOrigin tasks.
You can use script to access the current Session and read or write entries to it. So, for example, if you had a RunScript program you launched which then called Merge to create a document, you could arrange for Merge to add some entries to the Session, which you could then access back in your Runscript file. Or you could have your RunScript program add some additional information to the Session before running Merge and be able to retrieve that information within the Merge run.
Session File Format
Session information is stored as basic name:value pairs, similar to ini/profile entries or the cache mechanism of Merge. Values are currently strings or numbers. Names are standard alphanumeric names. DocOrigin does have some internally generated names such as _LastApp
and _LastUpdated
which are preceded by the underscore character - so it is best that you do not create names with a leading underscore.
Script access to Session data
Within DocOrigin tasks which support JavaScript, you can set Session values or fetch Session values using the _session functions. See _session for details.
Merge Command Line Options
DocOrigin Merge has a command option called -setSession which tells Merge to save named field values to the session file. You can specify a single field name to be saved or a semicolon-separated list of field names, e.g.
-setSession
"field1;field2;field3"
Specifying the wildcard
-setSession
*
will save all form fields to the session file. This means that you can return some or all of the document field name/value pairs to the task that called Merge. In all cases, it is the leaf node name that is saved. E.g. City, not ShipTo.City or BillTo.City. Also / consequently it is the last instance of each field that is saved/passed along.
Typically Merge is called in a Job Processing Script (JPS) and thus those returned session variables (fyi: sometimes we call them settings
) are available not only to the JPS but also to any subsequent DocOrigin programs called by that JPS.
Using the command
-setSession
*metadata
will cause selected metadata fields such as total DocumentCount, PageCount, and SheetCount to also be stored in the Session.
Hint: Use the _session.object()
script function to look at all the names/values saved for the session.
See Also
_session scripting
Auto/Embedded Fields
See the [!Session xxx] embedded field