ShawnJ007 Posted March 7, 2010 Share Posted March 7, 2010 Hi there, This is my first time working with COM and SDKs, so I'm learning as I go. I need some help and clarification... I'm working on converting a sample script for a SDK from VB to Au3. I'm getting an error message when trying to store data received from the SDK in to a variable. Please have a read below and let me know what you think I'm doing wrong. I really need to understand how VBs "Dim response As Object 'IResponse" initialization statement is reflected in the Au3 language. I've been playing around with another sample, and it stored the data from the SDK in to the response variable without any issue, and I was able to view the data. This sample however, halts and presents the error in the code snip below. Correct me if I'm wrong; the "triggers" in the COM are called Interfaces right? Under that assumption, "ISessionManager", "ICustomerQuery", "IMsgSetResponse", and "IResponse" are some of the many interfaces listed in the SDK. ...wait a sec is ' similar to ; and used for commenting? lol how do I initialize a new object type variable in au3? Related parts of the VB Sample Code: expandcollapse popupDim sessionManager As Object 'Q7B.ISessionManager Set sessionManager = New Q7BLib.ISessionManager Dim requestMsgSet As Object 'IMsgSetRequest Set requestMsgSet = sessionManager.CreateMsgSetRequest("", 6, 0) 'Add the request to the message set request object. Dim customerQuery As Object 'ICustomerQuery Set customerQuery = requestMsgSet.AppendCustomerQueryRq 'Set the elements of ICustomerQuery. customerQuery.ORCustomerListQuery.CustomerListFilter.MaxReturned.SetValue 1 ' Uncomment the following to see the response XML for debugging MsgBox requestMsgSet.ToXMLString, vbOKOnly, "RequestXML" ' Perform the request Dim responseMsgSet As Object 'IMsgSetResponse Set responseMsgSet = sessionManager.DoRequests(requestMsgSet) ' Uncomment the following to see the response XML for debugging MsgBox responseMsgSet.ToXMLString, vbOKOnly, "ResponseXML" ' Interpret the response Dim response As Object 'IResponse Dim statusCode, statusMessage, statusSeverity ' The response list contains only one response, ' which corresponds to our single request Set response = responseMsgSet.ResponseList.GetAt(0) statusCode = response.statusCode statusMessage = response.statusMessage statusSeverity = response.statusSeverity MsgBox "Status: Code = " & CStr(statusCode) & _ ", Message = " & statusMessage & _ ", Severity = " & statusSeverity & vbCrLf My Au3 Code: dim $MySessionManager = ObjCreate("Q7BLib.ISessionManager") If @error Or Not IsObj($MySessionManager) Then MsgBox(16, "My First App", "Unable to create COM Session: Session Manager") Exit EndIf $MyDBResponse = $MySessionManager.CreateMsgSetRequest("CA", 6, 0) If @error Then MsgBox(16, "My First App", "Unable to Create MsgSetRequest") Exit EndIf $requestMsgSet = $MySessionManager.CreateMsgSetRequest("", 6, 0) $customerQuery = $MyDBResponse.AppendCustomerQueryRq $customerQuery.ORCustomerListQuery.CustomerListFilter.MaxReturned.SetValue(1) $responseMsgSet = $MySessionManager.DoRequests($requestMsgSet) ;How can I view the response XML here similar to the VB code? $response = $responseMsgSet.ResponseList.GetAt(0) ;I want to then view the data in $response.statusCode, $response.statusMessage, and $response.statusSeverity in a msgbox. AutoIT Console Error: : ==> Variable must be of type "Object".: $response = $responseMsgSet.ResponseList.GetAt(0) $response = $responseMsgSet.ResponseList^ ERROR >Exit code: 1 Time: 0.509 Thanks Guys Link to comment Share on other sites More sharing options...
ShawnJ007 Posted March 8, 2010 Author Share Posted March 8, 2010 (edited) Ah Ha! I figured it out. I was able to have all of the data stored in the $response variable by changing: $response = $responseMsgSet.ResponseList.GetAt(0) to $response = $responseMsgSet.ToXMLString() All of this was outlined deeper in the documentation for the SDK. Edited March 8, 2010 by ShawnJ007 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now