Hi!
I want to schedule EOD update with amiquote, using windows task scheduler. I have come up with a simple bat file that seems to work. Just want to hear your comments and also if there is a better way, using better technics, safer, more stable etc.
An update. Same thing but now with a jscript. Also added that more days will be updated. I have seen that Yahoo sometimes has incorrect values for the latest days and it is corrected a few days later. So this script now updates the last 10 days.
var d = new Date();
WScript.echo("--- Amiquote downloadAndImport.js ", d, " ---");
var AQ = new ActiveXObject("AmiQuote.Document");
// Set FromDate to current time minus 10 days
var FromDate = new Date();
FromDate.setDate(FromDate.getDate() - 10);
// Set ToDate to current time
var ToDate = new Date;
WScript.echo("FromDate = ", FromDate.getDate(), ", ToDate = ", ToDate.getDate());
/* getVarDate is required to convert from JScript Date to OLE-automation date */
AQ.From = FromDate.getVarDate();
AQ.To = ToDate.getVarDate();
AQ.AutoImport = true; // import automatically
// set up AmiQuote for Yahoo, download and import
AQ.Open("yahoo.tls");
AQ.Source = 0; // Yahoo
AQ.Download(); // starts download
// wait until download and import is finished
while( AQ.DownloadInProgress || AQ.ImportInProgress )
{
WScript.sleep(5000); // wait 5 seconds before querying status again
}
WScript.echo("Yahoo complete");
// set up AmiQuote for Stooq, download and import
AQ.Open("stooq.tls");
AQ.Source = 5; // Stooq
AQ.Download(); // starts download
// wait until download and import is finished
while( AQ.DownloadInProgress || AQ.ImportInProgress )
{
WScript.sleep(5000); // wait 5 seconds before querying status again
}
WScript.echo("Stooq complete ");
WScript.echo("--- script finished ---");
WScript.echo(" ");
The Amibroker batch and scheduler is used, very convinient.

The scheduler calls a .bat file that calls the jscript. I didn't manage to call the jscript from scheduler so this is a temporary solution and it works. It's also an easy way to get a simple log file, log.txt. The .bat-file:
@echo OFF
call :sub >> log.txt 2>&1
exit /b
:sub
cd C:\Program Files (x86)\AmiBroker\AmiQuote
cscript //Nologo downloadAndImport.js >> log.txt
rem end of :sub
Batupermata: The difference is that it's automatic. Also it gets quotes for 10 days back. Amiquote auto update makes almost the same thing but manually. In my case I have a server for the quote database and all it does is updating the database from different data sources (right now yahoo and stooq).