How To Get Images Every Hour Automatically

shekharz

Active Member
#1
Hi,

I wish to know how one can get the chart-images in email on regular intervals like half-hourly or hourly etc. Right now, there is only one option available under EDIT \ IMAGE \ EXPORT TO FILE, but this option does not give us a facility to export the images every half-hour or hour.

With regard to the above, I wrote to Amibroker Support and received a reply which is as below :-

You can automate export using OLE automation interface
http://www.amibroker.com/guide/objects.html
For example

AB = new ActiveXObject("Broker.Application");
AB.ActiveWindow.ExportImage( "example.gif", 640, 480 );

(Open notepad, copy-paste above the code, save the file
with .JS extension, double clicking on .JS file will execute it.)

OLE automation can also be used from Visual Basic or
other COM/OLE - aware programs.


To be precise, I could NOT understand it yet and hence, I could not get the images in regular intervals like half-hourly or hourly.

If anybody can guide the whole process OR if someone could make a relevant JS File which can do the needful, then it will be of much help for most of the Amibroker Users .........

shekharz
 

manojborle

Well-Known Member
#2
Hi,

I wish to know how one can get the chart-images in email on regular intervals like half-hourly or hourly etc. Right now, there is only one option available under EDIT \ IMAGE \ EXPORT TO FILE, but this option does not give us a facility to export the images every half-hour or hour.

With regard to the above, I wrote to Amibroker Support and received a reply which is as below :-

You can automate export using OLE automation interface
http://www.amibroker.com/guide/objects.html
For example

AB = new ActiveXObject("Broker.Application");
AB.ActiveWindow.ExportImage( "example.gif", 640, 480 );

(Open notepad, copy-paste above the code, save the file
with .JS extension, double clicking on .JS file will execute it.)

OLE automation can also be used from Visual Basic or
other COM/OLE - aware programs.


To be precise, I could NOT understand it yet and hence, I could not get the images in regular intervals like half-hourly or hourly.

If anybody can guide the whole process OR if someone could make a relevant JS File which can do the needful, then it will be of much help for most of the Amibroker Users .........

shekharz
Hi
I tried the code and when i clicked on the file example.gif is created and saved in amibroker folder.
So it does copies image from active window in amibroker and pastes it in amibroker folder.
 

Cubt

Algo Trader
#3
Hi
I tried the code and when i clicked on the file example.gif is created and saved in amibroker folder.
So it does copies image from active window in amibroker and pastes it in amibroker folder.
Just save it as .js file and schedule the job to run every 30 mins, which will automatically export the image to the specified drive.
 

shekharz

Active Member
#4
To MANOJ,

Thanks for help. I also found out this ....... but still the problem remains to send the images into regular intervals .........

To CUBT,

Thanks buddy ......... but HOW TO SCHEDULE THE JOB TO RUN EVERY 30 MINUTES AND HOW TO SELECT ANY PARTICULAR FOLDER FOR THESE IMAGES, in the way described above, it only exports the images into Program Files \ Amibroker folder ........ how to change this folder to some other folder .........
 

KelvinHand

Well-Known Member
#6
To MANOJ,

Thanks for help. I also found out this ....... but still the problem remains to send the images into regular intervals .........

To CUBT,

Thanks buddy ......... but HOW TO SCHEDULE THE JOB TO RUN EVERY 30 MINUTES AND HOW TO SELECT ANY PARTICULAR FOLDER FOR THESE IMAGES, in the way described above, it only exports the images into Program Files \ Amibroker folder ........ how to change this folder to some other folder .........
All these problem was discuss long time ago.
http://www.traderji.com/amibroker/85464-auto-capture-image-some-help-required.html

Post #10 - talk about how to change folder
Post #1 - some idea of time counting.

Post #26 - JScript embeded in AFL by mastermind007


Here Time counting:
http://www.traderji.com/amibroker/89466-does-anyone-have-afl-3.html

also V5.60 new function, see Post #28 by trash
 
Last edited:

shekharz

Active Member
#7
All these problem was discuss long time ago.
http://www.traderji.com/amibroker/85464-auto-capture-image-some-help-required.html

Post #10 - talk about how to change folder
Post #1 - some idea of time counting.

Post #26 - JScript embeded in AFL by mastermind007


Here Time counting:
http://www.traderji.com/amibroker/89466-does-anyone-have-afl-3.html

also V5.60 new function, see Post #28 by trash
KELVINHAND

THANKS VERY MUCH.

It is good material and I need some time to study it ....... I will do it later today or tomorrow ........ But I do hope it will help & solve my problems .......

Thanks buddy .......

shekharz
 

KelvinHand

Well-Known Member
#8
KELVINHAND

THANKS VERY MUCH.

It is good material and I need some time to study it ....... I will do it later today or tomorrow ........ But I do hope it will help & solve my problems .......

Thanks buddy .......

shekharz


To call the script inside the Amibroker Scripts folder (work on V5.6x)


1. Test the following to make sure ShellExecute() work properly and picture is saved.
PHP:
 Capture = ParamTrigger("Capture", "Click");
 if ( Capture )
   ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");    //Assume the current folder is \Amibroker, direct it to \Scripts sub-folder

2. Once above test meet your environment, test out the Timing is working according to your specification
Try 1min and manual check whether the saved is incremental 1 min.
then 5min ... till 30min


PHP:
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
    Time         = Now( 4 );
    Seconds     = int( Time % 100 );
    Minutes     = int( Time / 100 % 100 );
    Hours     = int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}
 
RequestTimedRefresh( 1 );
TimeFrame=15;
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft     = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo     = TimeFrame - SecsLeft;
 
if ( NewPeriod )
{
 ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");  
}

3. After the above 2 tests pass, then you can work on other advance requirement.
 
Last edited:

shekharz

Active Member
#9
To call the script inside the Amibroker Scripts folder (work on V5.6x)


1. Test the following to make sure ShellExecute() work properly and picture is saved.
PHP:
 Capture = ParamTrigger("Capture", "Click");
 if ( Capture )
   ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");    //Assume the current folder is \Amibroker, direct it to \Scripts sub-folder

2. Once above test meet your environment, test out the Timing is working according to your specification
Try 1min and manual check whether the saved is incremental 1 min.
then 5min ... till 30min


PHP:
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
    Time         = Now( 4 );
    Seconds     = int( Time % 100 );
    Minutes     = int( Time / 100 % 100 );
    Hours     = int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}
 
RequestTimedRefresh( 1 );
TimeFrame=15;
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft     = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo     = TimeFrame - SecsLeft;
 
if ( NewPeriod )
{
 ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");  
}

3. After the above 2 tests pass, then you can work on other advance requirement.
Dear KelvinHand,

I have no words to show my gratitude for your help & everything ....

Thanks a lot bro ........

shekharz
 
#10
To call the script inside the Amibroker Scripts folder (work on V5.6x)


1. Test the following to make sure ShellExecute() work properly and picture is saved.
PHP:
Capture = ParamTrigger("Capture", "Click");
if ( Capture )
   ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");    //Assume the current folder is \Amibroker, direct it to \Scripts sub-folder

2. Once above test meet your environment, test out the Timing is working according to your specification
Try 1min and manual check whether the saved is incremental 1 min.
then 5min ... till 30min


PHP:
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
    Time         = Now( 4 );
    Seconds     = int( Time % 100 );
    Minutes     = int( Time / 100 % 100 );
    Hours     = int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}

RequestTimedRefresh( 1 );
TimeFrame=15;
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft     = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo     = TimeFrame - SecsLeft;

if ( NewPeriod )
{
ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts"); 
}

3. After the above 2 tests pass, then you can work on other advance requirement.
ShellExecute("wscript.exe", "ExportImage.js", ".\\Scripts");

[/Quote] how can i run above line only between specific time like

9.30 am to 3.30pm

Please help.[/Quote]
 

Similar threads