// I created this below
// Saved it as ExportImage.js from notepad
// Then saved it to folder: C:\Program Files\AmiBroker\Scripts\ExportImage.js
// Tried to create it as a Tool > Customize > Tool > New > ExportImage
// Command: wscript.exe
// Arguments: C:\Program Files\AmiBroker\Scripts\ExportImage.js
// Initial Directory: C:\DataExport
// Prompt for Arguments = Blank
// Then Tried To Execute:
// With the Selected Ticker as the Active Window...
// From Upper Ribbon > Tools > I Selected > ExportImage from bottom of list available
// *** Received Error Dialog Box: "There is no file extension in C:\Program".
// The Image format is set to .png in code below and why the folder change from code?
// Why does the error reflect C:\Program and NOT C:\DataExport\ per code below?
// Where is my error?
// Saved as ExportImage.js from notepad
outputdrivepath = "C:\DataExport\";
exportpath = outputdrivepath;
var oAB = WScript.CreateObject("Broker.Application");
Ticker = oAB.ActiveDocument.Name;
AB = new ActiveXObject("Broker.Application");
AW = AB.ActiveWindow;
filename = exportpath + Ticker + ".png";
WScript.Echo("ExportImage: " + filename);
AW.ExportImage( filename, 800, 600 );
WScript.Echo("ExportImage: Done !");
// please let me know where I am in error. thanks in advance.