Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

HELP ActiveX/COM DLL method works in VB but not Autoit


  • Please log in to reply
2 replies to this topic

#1 custos

custos

    Seeker

  • Active Members
  • 12 posts

Posted 20 August 2011 - 02:22 AM

I am able to use other methods etc for the following DLL using AutoIT, but 1 specific method creates the following error- (using autoit v3.3.6.1)

Plain Text         
; Piece of applicable code---NOT ALL CODE ; Setup model input output arrays per model - ; CH wants inarray(1..numrows, 1..NumInputs), outarray(1..numrows, 1..3) ; Local $InArr[$NumRows +1 ][$ch.NumInputs +1]        ; +1 necc, cause COM DLL ignores 0. ;YES $ch.NumInputs is properly filled as int by a call to the COM DLL Local $OutArr[$NumRows +1 ][3 +1 ]          ; Always 3 on 2nd dimension, per CH documentaion Local $price[$NumRows] ;$InArr[1][0]= 51.39 $InArr[1][1]= 51.39 $InArr[1][2]= 51.26 $InArr[1][3]= 51.37 $InArr[1][4]= 2938964 _ArrayDisplay($InArr) _ArrayDisplay($OutArr) _ArrayDisplay($price) ; Call Prediction model But ensure enough data present in data file $ret = $ch.Predict($NumRows, $InArr, $OutArr) If $ret <> 0 Then     ConsoleWriteError("ERROR: OpenModel returned: " & $ret)     Exit EndIf _ArrayDisplay($OutArr)


Error output from SCite

C:\Users\khan\CODE\CHwrapper.au3 (62) : ==> The requested action with this object has failed.: $ret = $ch.Predict($NumRows, $InArr, $OutArr) $ret = $ch.Predict($NumRows, $InArr, $OutArr)^ ERROR >Exit code: 1    Time: 4.779

Interestingly the same type of error occurs when i use $ret = $ch.Predict()! (that is no agrs given)

Yet it works w/ no problem using the following code in VB 2010-

Plain Text         
'Piece of applicable code---NOT ALL CODE Dim inar(,) As Object         Dim outar(,) As Object         Dim price() As Object         Dim objname As String         Dim strStartupArguments(), mdfile As String         Dim i, ret, intCount, numinputs, numrows As Integer         numrows = 1 numinputs = model.numinputs         ReDim inar(numrows, numinputs)         'the output array always has 3 columns         ReDim outar(numrows, 3)                 strStartupArguments = System.Environment.GetCommandLineArgs         'Skip 0th cause its the name of program         For intCount = 1 To UBound(strStartupArguments)             'Select Case strStartupArguments(intCount).ToLower             'Case "-arg1"             'Do your code for the arg1 argument             'Console.WriteLine(strStartupArguments(intCount))             inar(1, intCount) = strStartupArguments(intCount)             Console.WriteLine(inar(1, intCount))             'End Select         Next         'Apply the model         'ret = model.Predict(1, inar, outar, price)         'Not a trading strategy model         ReDim price(numrows)         'Apply the model         ret = model.Predict(numrows, inar, outar) ', price)         'Outar contains the following:         'column 1: raw formula output         'column 2: trade signals (0=no signal, 1=enter long, -1=enter short)         'column 3: equity curve         'if col 1 return = model.MissingValue, means could not be computed. E.g. SMA(X), doesnt have X vals yet!         If outar(numrows, 1) = model.MissingValue Then             Console.WriteLine("Model Returning = Missing Value, E.g x data point missing for sma(x) not computing")         End If     End Sub End Module


I've looked at VB debugger info and all the arrays seems the same going in (for autoit and VB), pls help been banging my head against this wall for 24+ hours now! I would hate to end up using VB2010 at this point.







#2 custos

custos

    Seeker

  • Active Members
  • 12 posts

Posted 20 August 2011 - 02:29 AM

btw used OLE/COM Browser(OLEview.exe) and here's what it says about this method-

[id(0x6003000e)] VARIANT Predict(                 [in, out] VARIANT* numrows,                 [in, out] VARIANT* inar,                 [in, out] VARIANT* outar,                 [in, out, optional] VARIANT* price);


#3 mv2112

mv2112

    Seeker

  • Active Members
  • 16 posts

Posted 29 August 2011 - 06:10 PM

Why are you adding 1 to each array dimention in AutoIT and not VBScript?
There's no place like ~/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users