After you have started the application as shown in Start Application, you will most likely want to programmatically open a document in order to work with it. The JScript code listing below illustrates how to open two documents from the Authentic Desktop Examples folder and set one of them as the active document.
// Locate examples via USERPROFILE shell variable. The path needs to be adapted to major release versions.
objWshShell = WScript.CreateObject("WScript.Shell");
majorVersionYear = objAuthentic.MajorVersion + 1998
strExampleFolder = objWshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\\My Documents\\Altova\\Authentic" + majorVersionYear + "\\AuthenticExamples\\";
// Tell Authentic to open two documents. No dialogs
objDoc1 = objAuthentic.Documents.OpenFile(strExampleFolder + "OrgChart.pxf", false);
objAuthentic.Documents.OpenFile(strExampleFolder + "ExpReport.xml", false);
// The document currently active can be easily located.
objDoc2 = objAuthentic.ActiveDocument;
// Let us make sure that the document is shown in Authentic view.
objDoc2.SwitchViewMode(5); // SPYViewModes.spyViewAuthentic = 5
// Now switch back to the document opened first
The JScript code listed above is available in the sample file DocumentAccess.js (see Example Files).
© 2019 Altova GmbH