how to use loop

outputdrive = "d:\\temp\\";

saveimage = outputdrive;

var oAB = WScript.CreateObject("Broker.Application");

ADS = oAB.Documents;

// Do not exceed number of active chart tabs.
// So if there are 3 chart tabs then max. number of Items is three, (0) to (3)

ADS.Item(0).ActiveWindow.ExportImage( "D:\\TEMP\\BANKNIFTY.png", 1000, 560);
ADS.Item(1).ActiveWindow.ExportImage( "D:\\TEMP\\NIFTY.png", 1000, 560);
ADS.Item(2).ActiveWindow.ExportImage( "D:\\TEMP\\TATASTEEL.png", 1000, 560);
ADS.Item(3).ActiveWindow.ExportImage( "D:\\TEMP\\ACC.png", 1000, 560);
ADS.Item(4).ActiveWindow.ExportImage( "D:\\TEMP\\TCS.png", 1000, 560);
ADS.Item(5).ActiveWindow.ExportImage( "D:\\TEMP\\INFY.png", 1000, 560);

Above codes are working fine in java script.

I want to to run above codes for 35 script hence i want to use loop
any one can tell me how to put above codes in loop
so that active charts will be saved in drive c:\temp\

pls help
Following works:

var oAB = WScript.CreateObject("Broker.Application");

ADS = oAB.Documents;

var i;

for (i = 0; i < ADS.Item.length; i++) {

ADS.Item(i).ActiveWindow.ExportImage( "C:\\TEMP\\Image"+i+".png", 1000, 560);


Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Are you a day trader?