[Resolved] How can I get the specific batch?

[Resolved] How can I get the specific batch?

Postby » Thu Mar 01, 2012 4:24 am

Dear all,
From kofax CMSample.NET code project, I found that there is a condition to set these 3 booleans at Generic.UpdateUI() :-
bBatchOpen
bOpenSpecific
bBatchesInQueue

After I add this sample to my batch queue, I have tried to scan a document, and then start debug it at the visual studio 2008 debugger, I found that m_oBatMan.AvailableBatchCount = 1, so bBatchesInQueue = true

This sample is pretty good. However mine is always getting the m_oBatMan.AvailableBatchCount = 0. So what things do I need to pay attention to? Please advice, thanks!

Here is some code in my custom module:-
bIsSelect is a boolean

Code: Select all
    Private Sub Form_Initialize()
        Try
            m_oBatMan = New clsBatchManager
            m_oBatMan.LoginToRuntimeSession("Kofax.Form1")

            '*** Add the BatchNotification event handler
            AddHandler m_oBatMan.BatchAvailable, _
                AddressOf m_oBatMan_BatchAvailable

            '*** Set XML files in queue specific folder in the local directory
            m_oBatMan.XmlRuntimeExportFile = "RtExport.xml"
            m_oBatMan.XmlRuntimeImportFile = "RtImport.xml"
            m_oBatMan.XmlDocumentExportFile = "DcExport.xml"
            m_oBatMan.XmlDocumentImportFile = "DcImport.xml"

            '*** Process command line options
            Dim oCmdLine As New clsCmdLine

            If oCmdLine.IsOption("B") = True Then
                m_lBatchId = Val(oCmdLine.GetOptionParameter("B"))
            End If
        Catch ex As Exception
            TextBox1.Text &= (ex.Message)
        End Try

    End Sub


    Private Sub UpdateUI()
        bBatchProcessed = False
        If m_oBatMan.ActiveBatch Is Nothing Then
            bBatchOpen = False
            If m_lBatchId > 0 Then
                bOpenSpecific = True
            End If
        Else
            bBatchOpen = True

            If Dir(m_oBatMan.XmlRuntimeImportFile) <> "" Then
                bBatchProcessed = True
            End If
        End If

        '*** Enable buttons based on number of available batches, used as part
        '*** of the BatchNotification feature
        bBatchesInQueue = (m_oBatMan.AvailableBatchCount > 0)
        bIsSelect = Not bBatchOpen And Not bOpenSpecific And bBatchesInQueue
    End Sub


Regards.
Last edited by steve lam on Fri Mar 02, 2012 1:20 am, edited 1 time in total.
Participant
 
Posts: 10
Joined: Mon Feb 06, 2012 2:42 am

Re: How can I get the specific batch?

Postby » Fri Mar 02, 2012 12:27 am

Dear all,
I have created a windows service project which can both run as a winform and windows service.
When my program run as a winform, it can successfully get activebatch. When it was started up as a windows service, it will throw me this error:
The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

Caused by this line@BatchMan class:
m_oLogin.ValidateUser(strUniqueId)

Some varibles:
strUniqueId: Kofax.TestWindowsService
ErrorCode: -2147417851

Please advice, thanks!
Participant
 
Posts: 10
Joined: Mon Feb 06, 2012 2:42 am

Re: How can I get the specific batch?

Postby » Fri Mar 02, 2012 1:19 am

OK, I found the solution

1. Check your service start up account, ensure it has enough permission associating with Kofax Capture
2. Login to Kofax with following setting (Default):
Code: Select all
m_oLogin.ValidateUser(strUniqueId, False, "admin")
Participant
 
Posts: 10
Joined: Mon Feb 06, 2012 2:42 am

Re: How can I get the specific batch?

Postby » Fri Mar 02, 2012 4:33 am

steve lam wrote:Dear all,
I have created a windows service project which can both run as a winform and windows service.


how'd you do this?
Participant
 
Posts: 3552
Joined: Mon Mar 13, 2006 12:00 pm
Location: Livonia, Michigan


Return to Custom Modules General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest