/* change this line according to your data file name */
var filename = "industry_data.txt";
var fso, f, r;
var ForReading = 1;
var AmiBroker;
var fields;
var stock;
/* Create AmiBroker app object */
AmiBroker = new ActiveXObject( "Broker.Application" );
/* ... and file system object */
fso = new ActiveXObject( "Scripting.FileSystemObject" );
/* open ASCII file */
f = fso.OpenTextFile( filename, ForReading);
/* read the file line by line */
while ( !f.AtEndOfStream )
{
r = f.ReadLine();
/* split the lines using comma as a separator */
fields = r.split(",");
/* add a ticker - this is safe operation, in case that */
/* ticker already exists, AmiBroker returns existing one */
stock = AmiBroker.Stocks.Add( fields[ 0 ] );
stock.FullName = fields[ 1 ];
/*stock.IndustryID = parseInt( fields[ 2 ] );*/
}
/* refresh ticker list and windows */
AmiBroker.RefreshAll();