Hi all.
Below is the javascript code which is working fine to export the image. I need to add selected date in the code but unable to do it. It is needed because I want to take image of same symbol multiple time.
AB = new ActiveXObject("Broker.Application");
Name = AB.ActiveDocument.Name;
exportPath = "C:\\Amibroker Scripting\\Export Image\\"+Name+".PNG";
AW = AB.ActiveWindow;
AW.ExportImage( exportPath);
i have save the following in a file named as
Auto_Export_to_png_deskTop.js >>
/////////////// start code ////////////////////////
// Auto Export to PNG
// this javascript which when double clicked will export symbol in
current active window to a .png file
// In the tools menu entry definition:
// Command: wscript.exe
// Arguments: //E:javascript Auto_Export_to_png_deskTop.js
// Initial Directory: E:\Stock\AmiBroker\Scripts\
saveimage = "C:\\Documents and Settings\\Administrator\\Desktop\\";
var oAB = WScript.CreateObject("Broker.Application");
Ticker = oAB.ActiveDocument.Name;
AB = new ActiveXObject("Broker.Application");
DateObj=new Date();
Ye=DateObj.getYear();
M=(DateObj.getMonth()+1);
D=DateObj.getDate();
H=DateObj.getHours();
mi=DateObj.getMinutes();
Win = AB.ActiveWindow;
output=saveimage + Ticker + "-"+D+M+Ye+"_"+H+"-"+mi+ ".png";
Win.ExportImage( output, 800, 600 );
var Shell;
Shell = new ActiveXObject("WScript.Shell");
Shell.Popup("Foto is ready",2); // 2 second to close the popup window
/////////////// end code ////////////////////////
Thanks. AFL version is fine also. Above code for java script is more suitable because I can create a Image saver button using that.
Thanks again.....
Here is my code which was developed by your help
AB = new ActiveXObject("Broker.Application");
Name = AB.ActiveDocument.Name;
AW = AB.ActiveWindow;
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + "." + today.getMinutes() + "." + today.getSeconds();
exportPath = "C:\\Amibroker Scripting\\Export Image\\"+Name+"_"+date+"_"+time+".PNG";
AW.ExportImage( exportPath);
var Shell;
Shell = new ActiveXObject("WScript.Shell");
Shell.Popup("Picture Saved In "+exportPath,2); // 2 second to close the popup window