Panos,

 

I love examples!

 

Had your code working, but with a script host error message. !  Still I have
3 images on my HD with the right file names per your code.  Decided to clean
up any loose ends including making sure no problems in the tools commands.
For the path on my computer:  I think the space between Program and Files
threw me off, so I relocated to a new directory with no spaces to contend
with in the path.  The arguments and locations are as follows:

 

Command:   wscript.exe

Arguments:  C:\Scripts\ Auto_Export_to_png_deskTop.js

Initial Directory:  C:\Scripts\

 

I was ready to claim victory, tried it out one last time and .. Darn!

 

Had the following message:

 

Execution of the Windows Script Host failed (Not enough storage is available
to complete this operation)

 

That can't be since I have 2 gigs of memory and had nothing else running.  I
also checked Task Manager which confirmed this.

 

I am sure the problem is in my computer at this point.  When I started
working on the saving of images a few days ago, I cleverly crashed my
computer when I did not go outside AB to use the ExportImage method.  I have
been getting one or more  AB exception errors each day, and none before the
crash occurred.

 

I tried System Restore with a Restore Point before the crash, and that
didn't help.  I am about ready to load a fresh copy of 5.00,, not the
update, 

 

Thanks for your code.  I really appreciate it.  I will keep plugging away.

 

Grover

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Panos Boufardeas
Sent: Thursday, August 07, 2008 6:28 AM
To: [email protected]
Subject: [amibroker] Re: Need help on Jscript

 

Hi
One more example for you... Grover

i have save the following in a file named << 
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
Panos

 

Reply via email to