[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] How to Exportimage files for current watchlist in jscript



PureBytes Links

Trading Reference Links

I find it hard to get sufficient information on how to use jscript 
together with AB. As a result I am still struggling with even small 
things. Here's one: 

The following jscript exports the current chart to a file on disc. 
Works fine. I even got the file name variable by inserting the 
ticker. 

Despite quite some time playing around with similar coding examples I 
can't figure out how to 

1. also save the chart file in the format P1_ + <chart number in 
watchlist> + .png  > so simply get numbered file names as a result 
based on the place of the item in the watchlist                 

2. also get a chart file from another tab sheet. Can't find the code 
for access to another tab sheet anywhere. Would be nice to be able to 
both save the current chart and several other tabs as well (best with 
tabsheet name I'd think because the numbering of sheets probably 
changes in 4.80 when moved.

3. Once this works I'd very much need to have this carried out for 
the 
whole current watchlist. How to for this for each item in the current 
list.


I'd very much appreciate suggestions and advice here. Even a 
reference 
to where to find the info somewhere might help. Best would be of 
course 
when someone likes to come up with complete working code. 

If not possible to do this only with jscript a combination with AFL 
would be fine. 


Regards

Bert


/*
U:\AmiBroker\Scripts\Export_current chart as gif picture.js
** AmiBroker/Win32 scripting Example TJ adapted 
** Purpose:	Exports current chart to disk using the current 
ticker 
symbol
** Language: 	JScript (Windows Scripting Host)
*/

/* output files on H drive on network */
Drive3 = "C:\\";
dir5h = Drive3;

var oAB = WScript.CreateObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var oStocks = oAB.Stocks;

Ticker = oAB.ActiveDocument.Name;

oStock = oStocks( Ticker );


var Qty = oStock.Quotations.Count; 

AB = new ActiveXObject("Broker.Application");


grafiek = dir5h +"P1_" + Ticker +".png";  
AB.ActiveWindow.ExportImage( grafiek, 1280, 960 );


grafiek2 = dir5h +"P1_" + Ticker +".png";  
AB.ActiveWindow.ExportImage( grafiek2, 1280, 960 );


grafiek3 = dir5h +"CurrentTicker.gif";  
AB.ActiveWindow.ExportImage( grafiek3, 1280, 860 );


//end of code










Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/