Sign in to follow this  
Followers 0
Shyju

Windows FAX Managment

2 posts in this topic

Can anybody help me to translate the below code to Autoit

----------------------------

Private Sub Form_Load()

Dim objFaxServer As New FAXCOMEXLib.FaxServer

Dim collFaxIncomingJobs As FAXCOMEXLib.FaxIncomingJobs

Dim objFaxIncomingJob As FAXCOMEXLib.FaxIncomingJob

'Error handling

On Error GoTo Error_Handler

'Connect to the fax server

objFaxServer.Connect("")

'Get the collection of jobs in the incoming queue

collFaxIncomingJobs = objFaxServer.Folders.IncomingQueue.GetJobs

'Display the number of jobs in the collection

MsgBox("There are " & collFaxIncomingJobs.Count & " jobs in the incoming queue.")

Dim n As Long

'Get the job

n = InputBox("Input the item number for which you want information.")

objFaxIncomingJob = collFaxIncomingJobs.Item(n)

'Refresh the job object (job is in process of being received, you

'want current information)

objFaxIncomingJob.Refresh()

'Display the job properties

MsgBox("Available operations: " & objFaxIncomingJob.AvailableOperations & _

vbCrLf & "Caller ID: " & objFaxIncomingJob.CallerId & _

vbCrLf & "CSID: " & objFaxIncomingJob.CSID & _

vbCrLf & "Current page: " & objFaxIncomingJob.CurrentPage & _

vbCrLf & "Device ID: " & objFaxIncomingJob.DeviceId & _

vbCrLf & "Extended status: " & objFaxIncomingJob.ExtendedStatus & _

vbCrLf & "Extended status code : " & objFaxIncomingJob.ExtendedStatusCode & _

vbCrLf & "Job ID: " & objFaxIncomingJob.Id & _

vbCrLf & "Job type: " & objFaxIncomingJob.JobType & _

vbCrLf & "Retries: " & objFaxIncomingJob.Retries & _

vbCrLf & "Routing information: " & objFaxIncomingJob.RoutingInformation & _

vbCrLf & "Size: " & objFaxIncomingJob.Size & _

vbCrLf & "Status: " & objFaxIncomingJob.Status & _

vbCrLf & "Transmission start: " & objFaxIncomingJob.Transmissionstart & _

vbCrLf & "Transmission end: " & objFaxIncomingJob.Transmissionend & _

vbCrLf & "TSID: " & objFaxIncomingJob.TSID)

'Allow user to cancel the selected fax

Dim CancelString As String

CancelString = InputBox("Cancel this fax (Y/N)?")

If CancelString = "Y" Then objFaxIncomingJob.Cancel()

'Allow user to open the selected fax

Dim OpenString As String

OpenString = InputBox("Open this fax (Y/N)?")

If OpenString = "Y" Then

Dim FileName As String

FileName = InputBox("Provide path and name of file for TIFF copy, e.g. c:\MyFax.tiff")

objFaxIncomingJob.CopyTiff(FileName)

'Open the tiff file

Dim A As Object

A = CreateObject("wscript.shell")

A.run(FileName)

End If

Exit Sub

Error_Handler:

'Implement error handling at the end of your subroutine. This

' implementation is for demonstration purposes

MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)

End Sub

------------------------

Basically I'm trying to take the incoming callerid/TSID to autoit..

Share this post


Link to post
Share on other sites



This is a complete stab in the dark, since I don't have that COM object, but I was bored.

It at least comes back with 0 syntax errors.

Local $objFaxServer = ObjCreate("FAXCOMEXLib.FaxServer")
Local $collFaxIncomingJobs = ObjCreate("FAXCOMEXLib.FaxIncomingJobs")
Local $objFaxIncomingJob = ObjCreate("FAXCOMEXLib.FaxIncomingJob")

;Error handling
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    

;Connect to the fax server
$objFaxServer.Connect("")

;Get the collection of jobs in the incoming queue
$collFaxIncomingJobs = $objFaxServer.Folders.IncomingQueue.GetJobs

;Display the number of jobs in the collection
MsgBox(0,"Incoming Jobs","There are " & $collFaxIncomingJobs.Count & " jobs in the incoming queue.")

Local $n

;Get the job
$n = InputBox("Enter Item Number","Input the item number for which you want information.")
If $n Then 
    $objFaxIncomingJob = $collFaxIncomingJobs.Item($n)
Else
    Exit
EndIf

;Refresh the job object (job is in process of being received, you
;want current information)
$objFaxIncomingJob.Refresh()

;Display the job properties
MsgBox(0,"Operations","Available operations: " & $objFaxIncomingJob.AvailableOperations & _
@CrLf & "Caller ID: " & $objFaxIncomingJob.CallerId & _
@CrLf & "CSID: " & $objFaxIncomingJob.CSID & _
@CrLf & "Current page: " & $objFaxIncomingJob.CurrentPage & _
@CrLf & "Device ID: " & $objFaxIncomingJob.DeviceId & _
@CrLf & "Extended status: " & $objFaxIncomingJob.ExtendedStatus & _
@CrLf & "Extended status code : " & $objFaxIncomingJob.ExtendedStatusCode & _
@CrLf & "Job ID: " & $objFaxIncomingJob.Id & _
@CrLf & "Job type: " & $objFaxIncomingJob.JobType & _
@CrLf & "Retries: " & $objFaxIncomingJob.Retries & _
@CrLf & "Routing information: " & $objFaxIncomingJob.RoutingInformation & _
@CrLf & "Size: " & $objFaxIncomingJob.Size & _
@CrLf & "Status: " & $objFaxIncomingJob.Status & _
@CrLf & "Transmission start: " & $objFaxIncomingJob.Transmissionstart & _
@CrLf & "Transmission end: " & $objFaxIncomingJob.Transmissionend & _
@CrLf & "TSID: " & $objFaxIncomingJob.TSID)

;Allow user to cancel the selected fax
Local $CancelString
$CancelString = MsgBox(4,"Cancel","Cancel this fax?")
If $CancelString = 6 Then $objFaxIncomingJob.Cancel()

;Allow user to open the selected fax
Local $OpenString
$OpenString = MsgBox(4,"Open","Open this fax?")
If $OpenString = 6 Then
    Local $FileName
    $FileName = InputBox("Enter File","Provide path and name of file for TIFF copy, e.g. c:\MyFax.tiff")
    $objFaxIncomingJob.CopyTiff($FileName)

    ;Open the tiff file
    Local $A
    $A = ObjCreate("wscript.shell")
    $A.run($FileName)
EndIf
Exit

    ;Implement error handling at the end of your subroutine. This 
    ; implementation is for demonstration purposes
    ; This is my custom defined error handler
Func MyErrFunc()

  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"      & @CRLF  & @CRLF & _
            "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
            "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
            "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
            "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
            "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
            "err.helpfile is: "     & @TAB & $oMyError.helpfile     & @CRLF & _
            "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
            
Endfunc

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0