Hi,
I do not see any imported data after running the following vbscript. Where is the mistake in the code?
' WIN 7 HomePremium SP1, ABx64 AmiBroker 6.30.0 RC November 18, 2018 18:13
' run: cscript /nologo 0_IMPORT_AQH2AB.vbs
' or c:\windows\syswow64\cscript.exe 0_import_aqa2ab_temp.vbs
' OLE import in vbs
' full installtion on AB 6.3
' run ABReg64
' Run AmiQuote Ticker=AA start_date=16.11.2018 - automatic import unchecked
' Database is given by AB
' I read
' AB Help / Reference Guide / AmiBroker's OLE Automation Object Model
' Return codes for ole calls
' 0=ok, 4=no file, 2/3=bad data errors - see import.log for more info
' Using Import() of OLE object
' Import data through ole with example: www.amibroker.com/newsletter/02-2001.html
' Using Specific Format with Batch "Data Import ASCII"
' Running OLE automation scripts with 32- and 64-bit versions of AmiBroker
' c:\windows\syswow64\cscript.exe 0_import_aqa2ab_temp.vbs
'
' Other infos
' coding vbscript and datafile in ansi
'
' in AB File / Import ASCII with aqh format works
MYDATABASE = "C:\PROGRAM FILES\AMIBROKER\DATA"
' call Broker as first object
Set oAB = GetObject("","Broker.Application")
' or Set oAB = CreateObject("Broker.Application")
oAB.Visible = True
if not oAB.LoadDatabase(MYDATABASE) Then
MsgBox "Can't Load Database" + MYDATABASE
errorlevel = 1
end if
WScript.Sleep 2000
' doesn't work: aqfilename = "C:\\PROGRAM FILES\\AMIBROKER\\AMIQUOTE\\DOWNLOAD\\AA.AQH"
' doesn't work: aqfilename = "C:\PROGRAM FILES\AMIBROKER\AMIQUOTE\DOWNLOAD\AA.AQH"
aqfilename = "C:\PROGRAM FILES\AMIBROKER\AMIQUOTE\DOWNLOAD\AA"
aqformat = "aqh.format"
if oAB.Import(0,aqfilename,aqformat) then
oAB.RefreshAll()
WScript.Echo aqfilename & " imported"
errorlevel = 0
else
MsgBox "can't import "+ aqfilename
errorlevel = 1
end if
WScript.Sleep 2000
oAB.SaveDatabase()
oAB.Quit()
' no import.log generated
' AA.aqh file
'$NAME AA
'# Date,Open,High,Low,Close,Adj Close,Volume
'19-11-2018,35.810001,35.994999,32.250000,33.490002,33.490002,4603100
'20-11-2018,32.419998,33.200001,31.980000,32.680000,32.680000,2938300
'21-11-2018,33.200001,33.389999,32.709999,32.799999,32.799999,1697200
'23-11-2018,32.049999,32.580002,31.629999,32.310001,32.310001,1346600
'26-11-2018,32.400002,32.860001,32.009998,32.570000,32.570000,2348200
'27-11-2018,32.139999,32.349998,30.950001,31.190001,31.190001,2964900
'28-11-2018,31.350000,34.169998,30.959999,33.599998,33.599998,5636700
'29-11-2018,33.450001,33.480000,30.979000,30.990000,30.990000,8105500
'30-11-2018,31.040001,32.459999,30.941999,31.809999,31.809999,5353800
' aqh.format file (as given)
' # AmiQuote historical quotes download format (.AQH extension)
'# Revision 1.4 - changed the order of columns (due to July 22, 2017 Yahoo site change)
'# Revision 1.3 - changed the order of columns (due to May 17, 2017 Yahoo site change)
'# Revision 1.1 - removed $VOLFACTOR 0.01
'# The format line below allows to get data adjusted for SPLITS
'# to get data adjusted for SPLITS AND DIVIDENDS replace 'Skip' by 'AdjClose'
'#
'$FORMAT Date_DMY,Open,High,Low,Close,Skip,Volume
'$SKIPLINES 0
'$BREAKONERR 0
'$SEPARATOR ,
'$DEBUG 1
'$AUTOADD 1
'$CONT 1
'$GROUP 254
'# the following switches are optional - please consult
'# the read-me for description of those options
'# $RAWCLOSE2OI 1
'# $RECALCSPLITS 1
'# $ROUNDADJ 4