OLE AnalysisDoc get symbol string

AB = new ActiveXObject( "Broker.Application" ); 

try
{
    NewA = AB.AnalysisDocs.Open( "C:\\analysis1.apx" ); 
    

    if ( NewA )
    {
         NewA.Run( 2 ); 

         while ( NewA.IsBusy ) WScript.Sleep( 500 ); 
         // Can add a functionality to OLE here
         // to retrieve a string containing all symbols separated by commas?
         // This way, we can directly send all the matching symbols to other software for interaction,
         // avoiding the tedious step of outputting to a file and then reading it back.
         // Or is there any way to directly get all symbols without exporting to a file?
         // I need to interact with other software, so using OLE is a must.
         NewA.Export( "test.html" ); 

         WScript.echo( "Completed" );

         NewA.Close(); 
     }
}
catch ( err )
{
     WScript.echo( "Exception: " + err.message ); 
}

My question in the comments section of the code.

You don't need OLE automation for this at all.

Just write the symbols from the formula to the file directly:

// open file in "share-aware" append mode
fh = fopen( "TheFileName.txt", "a", True );

// proceed if file handle is correct
if ( fh )
{
   // write to file
   fputs( Name() +"\n" );
   // close file handle
   fclose( fh );
}
1 Like