dcat127 Posted April 12, 2010 Share Posted April 12, 2010 I am trying to use Autoit with Quickbooks sdk to retrieve the customer list. $sessionMan = ObjCreate("QBFC8.QBSessionManager.1") If Not IsObj($sessionMan) Then MsgBox(0, "ERROR", "Session Management: Unable to create object.") $sessionMan.OpenConnection("myapp2", "myapp2") $sessionMan.BeginSession("", 2) $reqMsgSet = $sessionMan.CreateMsgSetRequest("US", 1, 1) $customerQuery = $reqMsgSet.AppendCustomerQueryRq() $ListMergeSampleResp = $sessionMan.DoRequests($reqMsgSet) MsgBox(0, "", $ListMergeSampleResp) ; Close the session and connection with QuickBooks. $sessionMan.EndSession $sessionMan.CloseConnection I am able to connect successfully, and Quickbooks pauses about the right amount of time to retrieve the customer list when line 8 is executed. The msgbox however does not contain any information. Am I doing some thing that is obviously wrong? This is the first time I am working with com/obj. Thanks for any help. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 12, 2010 Share Posted April 12, 2010 I would expect $ListMergeSampleResp to be returned as a collection object or something similar. Try: $ListMergeSampleResp = $sessionMan.DoRequests($reqMsgSet) If IsObj($ListMergeSampleResp) Then $iCnt = 0 For $oSampleResp In $ListMergeSampleResp $iCnt += 1 Next MsgBox(64, "Object", "Object contains " & $iCnt & " elements") Else MsgBox(16, "Not Object", "Not and object") EndIf That will tell you if it's an object, and if that object is a collection. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dcat127 Posted April 13, 2010 Author Share Posted April 13, 2010 I get the response "Object contains 0 elements" What does this mean? Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 14, 2010 Share Posted April 14, 2010 First impression is that you got an empty collection. We don't have the SDK, you do. How does it describe the method you called and the return value from it? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dcat127 Posted April 21, 2010 Author Share Posted April 21, 2010 Looks like I missed: $output = $ListMergeSampleResp.ToXMLString() This code now returns an xml string with the customer list $sessionMan = ObjCreate("QBFC8.QBSessionManager.1") If Not IsObj($sessionMan) Then MsgBox(0, "ERROR", "Session Management: Unable to create object.") $sessionMan.OpenConnection("myapp2", "myapp2") $sessionMan.BeginSession("", 2) $reqMsgSet = $sessionMan.CreateMsgSetRequest("US", 1, 1) $customerQuery = $reqMsgSet.AppendCustomerQueryRq() $ListMergeSampleResp = $sessionMan.DoRequests($reqMsgSet) $output = $ListMergeSampleResp.ToXMLString() MsgBox(0, "", $output) ; Close the session and connection with QuickBooks. $sessionMan.EndSession $sessionMan.CloseConnection b1nar10 1 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