how to run this javascript with time-interval

vijayanscbe

Well-Known Member
#1
importquotes();

function importquotes()
{
filename = "C:\\Program Files\\AmiBroker\\Data Downloader\\gData\\_NSEBANK.txt";
AmiBroker = new ActiveXObject("Broker.Application" );

AmiBroker.Import( 0, filename, "gdata.format" );
AmiBroker.RefreshAll();
}

//////////////////////////////////////////////////////////////////////////////

i m using the above js for importing the datas in amibroker ...........

how to run the above script with time interval .................

i mean the above script should run automatically with some specified time interval ..........

any body knows pls share it ............

thanks in advace ..............
 

kdhrubo

Active Member
#2
In the last line of your function add this line
setTimeout ( "importquotes()", 2000 );

This will call your method each 2000 milisecond intervals
Let me know if you need more help
 

Pattel

Well-Known Member
#5
Task scheduler in windows will not run javascript
write a one liner .bat file to run java script and call the batch file from scheduler, you can do this.
 

kdhrubo

Active Member
#6
write a one liner .bat file to run java script and call the batch file from scheduler, you can do this.
Can we make this even more complicated please ? :lol:
That will not work
You need an engine for Javascript to run. This engine is either in the browser or in a Java Virtual Machine which now supports scripting.
So the only solution is to add this single line in the end of the JS function , embed it in html and just open it in the browser.
 

vijayanscbe

Well-Known Member
#7
^^^^^
kdhrubo

thanks for replying....................... :clap:

am completely new for programming etc............

at present i hav saved the javascript in a file and running by doubl click every time..............

u hav given a a command to add in last line...........

can u explain after adding how to convert to html and how to run browser......... whether it si must to run in a browser ??????

thanks in advance............. :thumb:
 

kdhrubo

Active Member
#8
^^^^^
kdhrubo

thanks for replying....................... :clap:

am completely new for programming etc............

at present i hav saved the javascript in a file and running by doubl click every time..............

u hav given a a command to add in last line...........

can u explain after adding how to convert to html and how to run browser......... whether it si must to run in a browser ??????

thanks in advance............. :thumb:
contact me - kdhrubo at ymail dot co dot in
 

Similar threads