Altova Authentic 2024 Desktop

The JScript below starts the application and shuts it down. If the COM object of the 32-bit Authentic Desktop cannot be found, the code attempts to get the COM object of the 64-bit application; otherwise, an error is thrown. If an instance of the application is already running, the running instance will be returned.

 

 

Note :Pour Authentic Desktop 32-bit, le nom enregistré ou l'identificateur programmatique (ProgId) de l'objet COM est AuthenticDesktop.Application. Pour Authentic Desktop 64-bit, le nom est AuthenticDesktop_x64.Application. Néanmoins, n'oubliez pas que le programme d'appel accédera aux entrée de registre CLASSES dans sa propre ruche de registre, ou groupe (32-bit ou 64-bit). C'est pourquoi, si vous exécutez des scripts en utilisant l'invite de commande standard et Windows Explorer sur Windows 64-bit, les entrées de registre 64-bit seront accédées, et pointeront vers le Authentic Desktop 64-bit. Pour cette raison, si les deux Authentic Desktop 32-bit et 64-bit sont installés, une gestion spéciale est nécessaire afin de pouvoir appeler le Authentic Desktop 32-bit. Par exemple, si on part du principe que Windows Scripting Host est le programme d'appel, procéder comme suit :

 

1.Changer le répertoire actuel à C:\Windows\SysWOW64.

2.Dans la ligne de commande, saisir wscript.exe suivi du chemin vers le script que vous souhaitez exécuter, par exemple :

 

wscript.exe "C:\Users\...\Documents\Altova\Authentic2024\AuthenticExamples\API\JScript\start.js"

 

 

// Initialize application's COM object. This will start a new instance of the application and
// return its main COM object. Depending on COM settings, the main COM object of an already
// running application might be returned.
 
try {   objAuthentic = WScript.GetObject("", "AuthenticDesktop.Application");   }
catch(err) {}
 
if( typeof( objAuthentic ) == "undefined" )
{
  try   {   objAuthentic = WScript.GetObject("", "AuthenticDesktop_x64.Application")   }
  catch(err)
  {
     WScript.Echo( "Can't access or create AuthenticDesktop.Application" );
     WScript.Quit();
  }
}
 
// if newly started, the application will start without its UI visible. Set it to visible.
objAuthentic.Visible = true;
 
WScript.Echo(objAuthentic.Edition + " has successfully started. ");
 
objAuthentic.Visible = false; // will shutdown application if it has no more COM connections
//objAuthentic.Visible = true;   // will keep application running with UI visible

 

 

The JScript code listed above is available in the sample file Start.js (see Example Files).

© 2017-2023 Altova GmbH