Auo Export to GIF Images by an AFL--- Correction to codes requested

#1
Dear Seniors,

A help is needed to correct the codes which should export the file to GIF in a folder.

outputdrive = "C:\\";

saveimage = outputdrive;

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

Ticker = oAB.ActiveDocument.Name;

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

Win = AB.ActiveWindow;

output=saveimage + Ticker + ".gif";

Win.ExportImage( output, 800, 600 );

This is giving errors.

Found Some advice from a member http://www.traderji.com/amibroker/45185-amibroker-screen-autoexport-c-drive-correct-code-please.html

Please advice how to operate.
 
Last edited:

KelvinHand

Well-Known Member
#2
Dear Seniors,

A help is needed to correct the codes which should export the file to GIF in a folder.

outputdrive = "C:\\";

saveimage = outputdrive;

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

Ticker = oAB.ActiveDocument.Name;

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

Win = AB.ActiveWindow;

output=saveimage + Ticker + ".gif";

Win.ExportImage( output, 800, 600 );

This is giving errors.

Found Some advice from a member http://www.traderji.com/amibroker/45185-amibroker-screen-autoexport-c-drive-correct-code-please.html

Please advice how to operate.
do not send it to the root dir:c:\\, cause window not allow.
send it to a folder such as c:\\temp\\"

it you outputdrive = "", the image will be saved in Amibroker folder

Put in Folder\FileName: Amibroker\Scripts\ExportImage.js

Code:
outputdrive = "C:\\temp\\";

saveimage = outputdrive;

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

Ticker = oAB.ActiveDocument.Name;

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

Win = AB.ActiveWindow;

output=saveimage + Ticker + ".gif";

WScript.Echo("ExportImage: " + output);

Win.ExportImage( output, 800, 600 );

WScript.Echo("ExportImage: Done !");

setup:
- Goto Tools => Customize..
- Select "Tools" Tab
- Press [New] button, create the List named "ExportImage".
- Fill the following:
* Command: wscript.exe
* Arguments: "C:\Program Files (x86)\AmiBroker\Scripts\ExportImage.js"
- Close the Dialog.

Execute:
- Goto Tools, Run "ExportImage"

Done.
 
Last edited:
#3
Many Many Thanx Kelvin,

Its exporting on
Execute:
- Goto Tools, Run "ExportImage"


But, can it plannted so that it exports at every fixed interval like 1 sec or 2 sec.


The AFL
Capture = ParamTrigger("click","Capture");
if ( Capture )
ShellExecute("C:\\Program Files\\Amibroker\\Scripts\\ExportImage.js","","");

Plz guide way forward.

thanx
 
#4
Alternatively I have found it:-

EnableScript("jscript");EnableScript("jscript");
<%
function multiCapture()
{
AB = new ActiveXObject("Broker.Application");
ADS = AB.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 (2)
ADS.Item(0).ActiveWindow.SelectedTab = 1; //sheet 2 of tab 1
ADS.Item(0).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);

ADS.Item(1).ActiveWindow.SelectedTab = 2; //sheet 3 of tab 2
ADS.Item(1).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);

ADS.Item(2).ActiveWindow.SelectedTab = 3; //sheet 4 of tab 3
ADS.Item(2).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);
}
%>

script = GetScriptObject();

if ( Status("action") == actionScan ) script.multiCapture();

Buy = 0;
It scan and export the images to C:\\temp\\ but suggest way out so that script name like Nifty-1, or SBIN-1 is exported.

thnx
 

Vertigo_1985

Well-Known Member
#5
Re: Auto Export to GIF Images by an AFL--- Correction to codes requested

Hi,
I want to get image of 1-min intraday chart for first half hour of the trading session. Is there any way (AFL) by which i can automate this process ? i want different image for each day saved automatically.

And above script replaces previous image, so what can we do to link the filename to date and timeframe ?

Regards
 
#6
Thanks a lot kelvin sir , and if anyone want to change image path change ,
outputdrive = "C:\\temp\\"; to outputdrive = "E:\\Amibroker Images\\";
or anything you like .
 
#7
do not send it to the root dir:c:\\, cause window not allow.
send it to a folder such as c:\\temp\\"


Kevin
Is there a way that we can initiate the same if there is a buy or sell signal....

I'm trying such a similar task, trying to genarate an excel / csv file... I'm able to genarate (Found the below code in this forum) but unable to write the signal or unable to achieve my task of writing only if there is a buy or sell, kindly help
 
#8
do not send it to the root dir:c:\\, cause window not allow.
send it to a folder such as c:\\temp\\"


Kevin
Is there a way that we can initiate the same if there is a buy or sell signal....

I'm trying such a similar task, trying to genarate an excel / csv file... I'm able to genarate (Found the below code in this forum) but unable to write the signal or unable to achieve my task of writing only if there is a buy or sell, kindly help

i have tried n got the image in my temp folder
but i m not succeeded in getting image auto after given interval
means not getting how to use below code

Capture = ParamTrigger("Capture", "Click");
if ( Capture )
ShellExecute("C:\\Program Files\\Amibroker\\Scripts\\ScreenShot.js","","");

plz hwo do i use it?
 
#9
i have tried n got the image in my temp folder
but i m not succeeded in getting image auto after given interval
means not getting how to use below code

Capture = ParamTrigger("Capture", "Click");
if ( Capture )
ShellExecute("C:\\Program Files\\Amibroker\\Scripts\\ScreenShot.js","","");

plz hwo do i use it?
Param is when you right click the chart, you see parameters to be specified.... you can click the option capture to export image.....

You can also use the code where the AFL's gen signals, just include the code inside the IF condition

IIf buy
plotshapes uparrow
plottext buy
export image etc,.
condition end.

I tried and it worked fine....:clap:
 
#10
Alternatively I have found it:-

EnableScript("jscript");EnableScript("jscript");
<%
function multiCapture()
{
AB = new ActiveXObject("Broker.Application");
ADS = AB.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 (2)
ADS.Item(0).ActiveWindow.SelectedTab = 1; //sheet 2 of tab 1
ADS.Item(0).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);

ADS.Item(1).ActiveWindow.SelectedTab = 2; //sheet 3 of tab 2
ADS.Item(1).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);

ADS.Item(2).ActiveWindow.SelectedTab = 3; //sheet 4 of tab 3
ADS.Item(2).ActiveWindow.ExportImage( "C:\\temp\\chart1.png", 800, 600);
}
%>

script = GetScriptObject();

if ( Status("action") == actionScan ) script.multiCapture();

Buy = 0;
It scan and export the images to C:\\temp\\ but suggest way out so that script name like Nifty-1, or SBIN-1 is exported.

thnx


Dear Sir,

Please guide me how to automatically generate images , every 5 second interval.

Thanks in Advance.