Start Application Imprimir este apartado Página anterior Subir un nivel Página siguiente

Inicio >  Referencia del programador > Application API > Overview > Programming Languages > JScript >

Start Application

The JScript below starts the application and shuts it down. If the COM object of the 32-bit StyleVision 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:For 32-bit StyleVision, the registered name, or programmatic identifier (ProgId) of the COM object is StyleVision.Application. For 64-bit StyleVision, the name is StyleVision_x64.Application.


// 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 {   objStyleVision = WScript.GetObject("", "StyleVision.Application");   }
catch(err) {}
if( typeof( objStyleVision ) == "undefined" )
  try   {   objStyleVision = WScript.GetObject("", "StyleVision_x64.Application")   }
     WScript.Echo( "Can't access or create StyleVision.Application" );
// if newly started, the application will start without its UI visible. Set it to visible.
objStyleVision.Visible = true;
WScript.Echo(objStyleVision.Edition + " has successfully started. ");
objStyleVision.Visible = false; // will shutdown application if it has no more COM connections
//objStyleVision.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).

© 2019 Altova GmbH