Jump to content

Recommended Posts

Posted

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.

Posted

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
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...