Job object example

The following code illustrates the use of the Job object and its properties and methods.

Public Sub GetAllStatistics(CurrApplication As Object, _

CurrJob As Object)

'---------------------------------------------------------------------

' Call this function in for example the JobStopped event.

' Supply the function with the current Application object, as well as

' the current Job object

'---------------------------------------------------------------------

    Dim strMsg As String

    Dim i As Integer

    Dim strCharStat As String     'string for character statistics

    Dim strFormStat As String    'string for form statistics

    Dim strName As String         'Name of form definition

    Dim strTitle As String

    'variables for statistics

    Dim lngTotItrp As Long

    Dim lngCertain As Long

    Dim lngUnCertain As Long

    Dim lngUnknown As Long

    Dim lngCompleteForm As Long

    Dim lngRetypeForm As Long

    Dim lngIncompl As Long

    Dim lngValErr As Long

    Dim lngItrpErr As Long

    Dim lngMassVerify As Long

    Dim lngAppx As Long

    Dim lngTotCharItrp As Long

    Dim lngCharCertain As Long

    Dim lngCharUnCertain As Long

    Dim lngCharUnknown As Long

 

    strMsg = ""

 

    Select Case CurrApplication.Name

        Case "efmngr"

            MsgBox "There are no statistics for the Manager module"

        '----------------------------------------------------------

        Case "efitrp"

        'Interpret Statistics

        'Headlines

           strMsg = strMsg & "Character statistics:" & vbCrLf

           strCharStat = "FormDefName" & vbTab & "Total" & vbTab & _

                  "CharCertain" & vbTab & "CharUnCertain" & _

                  vbTab & "CharUnknown" & vbCrLf

           strFormStat = "Form statistics:" & vbCrLf

           strFormStat = strFormStat & "FormDefName" & vbTab & _

                  "Total" & vbTab & "Complete" & vbTab & _

                  "Retype" & vbTab & "Incompl" & vbTab & _

                  "ValErr" & vbTab & "ItrpErr" & vbTab & _

                  "MassVerify" & vbTab & "Appx" & vbCrLf

           'statistics for one form at a time

           For i = 1 To CurrJob.NoOfFormDefs

             strName = CurrJob.GetFormDefName(i) & _

                    "(" & i & ")" & vbTab

           Call CurrJob.GetInterpretStatistics(i, _

                  lngTotCharItrp, lngCharCertain, _

                  lngCharUnCertain, lngCharUnknown, _

                  lngTotItrp, lngCompleteForm, _

                  lngRetypeForm, lngIncompl, lngValErr, _

                  lngItrpErr, lngMassVerify, lngAppx)

           strCharStat = strCharStat & strName & vbTab & _

                  lngTotCharItrp & vbTab & vbTab & _

                  lngCharCertain & vbTab & vbTab & _

                  lngCharUnCertain & vbTab & vbTab & _

                  lngCharUnknown & vbCrLf

           strFormStat = strFormStat & strName & vbTab & _

             lngTotItrp & vbTab & lngCompleteForm & _

                    vbTab & lngRetypeForm & vbTab & _

                        lngIncompl & vbTab & lngValErr & _

                        vbTab & lngItrpErr & vbTab & _

                        lngMassVerify & vbTab & vbTab & _

                        lngAppx & vbCrLf

           Next i

           strMsg = strMsg & strCharStat & strFormStat

           'Total character statistics

           Call CurrJob.GetInterpretCharacterStatistics( _

           lngTotItrp, lngCertain, lngUnCertain, lngUnknown)

           strMsg = strMsg & "Total character statistics:" & vbCrLf

           strMsg = strMsg & "TotItrp" & vbTab & "Certain" & vbTab &

               "UnCertain" & vbTab & "Unknown" & vbCrLf

           strMsg = strMsg & lngTotItrp & vbTab & lngCertain & _

                        vbTab & lngUnCertain & vbTab & _

                        lngUnknown & vbCrLf

        '----------------------------------------------------------

        Case "efverify"

        'Verify Statistics

               strCharStat ="Verify Statistics" & vbCrLf & _

                        "FormDefName" & vbTab & "Total" & vbTab & _

                        "Complete" & vbTab & "Retype" & vbTab & _

                        "lngIncompl" & vbTab & "ValError" & vbTab & _

                        "lngItrpErr" & vbTab & _

                        "lngMassVerify" & vbTab & "Removed" & vbCrLf

           For i = 1 To CurrJob.NoOfFormDefs

               strName = CurrJob.GetFormDefName(i) & _

                            "(" & i & ")" & vbTab

           Call CurrJob.GetVerifyStatistics(i, lngTotCharItrp, _

                        LngCompleteForm, lngRetypeForm, lngIncompl, _

                        lngValErr, lngItrpErr, lngMassVerify, lngAppx)

                        strCharStat = strCharStat & strName & vbTab & _

                        lngTotCharItrp & vbTab & lngCompleteForm & _

                        vbTab & lngRetypeForm & vbTab & lngIncompl & _

                        vbTab & lngValErr & vbTab & lngItrpErr & _

                        vbTab & lngMassVerify & vbTab & vbTab & _

                        lngAppx & vbCrLf

           Next i

           strMsg = strMsg & strCharStat

           strMsg = strMsg & "Number of keystrokes:" & _

                       CurrJob.KeyStrokes & vbCrLf

        '----------------------------------------------------------

        End Select

 

    'Time to show the result

    strTitle = CurrJob.Name

        Call MsgBox(strMsg, vbOKOnly, strTitle)

 

End Sub