Re: AFax - send RTF to buddy Was: AFax - get fax images
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
BTW. You can use it to send any printable files - OpenOffice (ODF), MS Office, if these application was installed. Just replace line $DocumentFilename = @ScriptDir & '\test.rtf' to $DocumentFilename = @ScriptDir & '\test.odt' or $DocumentFilename = @ScriptDir & '\test.doc' I have problem with autofaxing PDF files. AdobeReader notified that it can't open my valid file 'test.pdf'. Any ideas? Valery --- In [email protected], "valery_vi" <shehrer1@...> wrote: > > Hi, > > Next script AFax3.au3 shows simple faxing RTF doc: > ;=========================================== > ; AFax by Valery Ivanov > ; Send RTF document to fax#55555 > ; Important note: > ; Minimum operating systems Windows XP, Windows Server 2003 > > Global $FaxServer, $FaxDocument, $Recipients > Global $MsgTitle = 'AFax by Valery Ivanov' > > ;=========================================== > ;Documents > $FaxServer = ObjCreate('FaxComEx.FaxServer') > if Not IsObj($FaxServer) then > MsgBox(0,$MsgTitle, 'FaxServer was not created!') > exit > endif > > ; Connect to the local fax server. > $FaxServer.Connect('') > if @Error then > MsgBox(0,$MsgTitle, 'FaxServer was not connected!') > exit > endif > DisplayFaxServerInfo($FaxServer) > > ;=========================================== > ;Documents > ;Create Document > $FaxDocument = ObjCreate('FaxComEx.FaxDocument') > if Not IsObj($FaxDocument) then > MsgBox(0,$MsgTitle, 'FaxDocument was not created!') > exit > endif > MsgBox(0,$MsgTitle, 'FaxDocument was created!') > > $DocumentFilename = @ScriptDir & '\test.rtf' > MsgBox(0,$MsgTitle, '$DocumentFilename : ' & $DocumentFilename) > > $FaxDocument.Body = $DocumentFilename > $FaxDocument.Priority = 2 > > ;============================ > ;Recipients > ; There is only one > > $Recipients = $FaxDocument.Recipients > if Not IsObj($Recipients) then > MsgBox(0,$MsgTitle, 'Recipients was not created!') > exit > endif > > ;============================== > ; Recipient should have The Canonical Addresses > ; see: > ; http://msdn2.microsoft.com/en-us/library/ms726017.aspx > $Phone = '7(555)5555555' > $Name = 'Russian Buddy' > $Recipients.Add($Phone,$Name) > $FaxDocument.AttachFaxToReceipt = -1 > > MsgBox(0,$MsgTitle, 'Recipients count: ' & $Recipients.Count) > > $FaxDocument.Subject = 'Hello fax!' > > ;Set the receipt type to email > $FaxDocument.ReceiptType = 4 > > $FaxDocument.Subject = "Today's fax" > $JobId = $FaxDocument.Submit('') > MsgBox(0,$MsgTitle, 'Job Id : ' & $JobId[0]) > exit > > ;============================== > ;Display Fax Server Info > func DisplayFaxServerInfo($FaxServer) > local $Msg = 'Fax Server Info:' & @CrLf > $Msg &= ' API Version: ' & $FaxServer.APIVersion & @CrLf > $Msg &= ' Debug: ' & $FaxServer.Debug & @CrLf > $Msg &= ' Build and version: ' & $FaxServer.MajorBuild & '.' & > $FaxServer.MajorVersion & '.' & $FaxServer.MinorVersion & @CrLf > $Msg &= ' Server Name: ' & $FaxServer.ServerName & @CrLf > MsgBox(0,$MsgTitle, 'FaxDevice' & @CrLf & $Msg) > endfunc > > func ToBool($v) > if $v = -1 then return TRUE > return FALSE > endfunc > > NOTE: You should have file 'test.rtf' in folder @ScriptDir and change > Fax/Phone #. > > I hope that it will not be a base of fax spam. > ;-) > > Valery > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > Hi, > > > > Next script AFax2.au3: > > > > ;Get faxes from the outgoing fax archive and copy theirs into > script > > folder > > ; Important note: > > ; Minimum operating systems Windows XP, Windows Server 2003 > > > > Global $FaxServer, $FaxActivity, $FaxDevices, $FaxDevice > > Global $MsgTitle = 'Fax Sample' > > > > $FaxServer = ObjCreate('FaxComEx.FaxServer') > > if Not IsObj($FaxServer) then > > MsgBox(0,$MsgTitle, 'FaxServer was not created!') > > exit > > endif > > > > ; Connect to the local fax server. > > $FaxServer.Connect('') > > if @Error then > > MsgBox(0,$MsgTitle, 'FaxServer was not connected!') > > exit > > endif > > DisplayFaxServerInfo($FaxServer) > > > > ;Create the outgoing archive > > $FaxOutArchive = $FaxServer.Folders.OutgoingArchive > > if Not IsObj($FaxOutArchive) then > > MsgBox(0,$MsgTitle, 'FaxOutArchive were not created!') > > exit > > endif > > > > DisplayOutArchiveInfo($FaxOutArchive) > > > > ;Get the outgoing message > > > > $FaxOutgoingMessageIterator = $FaxOutArchive.GetMessages() > > if Not IsObj($FaxOutgoingMessageIterator) then > > MsgBox(0,$MsgTitle, 'FaxOutgoingMessageIterator were not > created!') > > exit > > endif > > > > $TiffId = 0 > > ;Moving through archive messages > > $FaxOutgoingMessageIterator.MoveFirst() > > While $FaxOutgoingMessageIterator.AtEOF <> -1 > > $OutMsg = $FaxOutgoingMessageIterator.Message > > if Not IsObj($OutMsg) then > > MsgBox(0,$MsgTitle, 'OutgoingMsg were not obtained!') > > exit > > endif > > DisplayOutMsgInfo($OutMsg) > > ;get and put image of Fax > > $OutMsg.CopyTiff(@ScriptDir & '\OutFax_' & $TiffId & '.tif') > > $OutMsg = 0 > > $FaxOutgoingMessageIterator.MoveNext() > > $TiffId += 1 > > wend > > exit > > > > ;Display Outgoing Msg Info > > func DisplayOutMsgInfo($OutMsg) > > local $Msg = 'Outgoing Msg Info:' & @CrLf > > $Msg &= ' CSID: ' & $OutMsg.CSID & @CrLf > > $Msg &= ' TSID: ' & $OutMsg.TSID & @CrLf > > $Msg &= ' DeviceName: ' & $OutMsg.DeviceName & @CrLf > > $Msg &= ' DocumentName: ' & $OutMsg.DocumentName & @CrLf > > $Msg &= ' Id: ' & $OutMsg.Id & @CrLf > > $Msg &= ' Pages: ' & $OutMsg.Pages & @CrLf > > $Msg &= ' Priority: ' & $OutMsg.Priority & @CrLf > > $Msg &= ' Retries: ' & $OutMsg.Retries & @CrLf > > $Msg &= ' Size: ' & $OutMsg.Size & @CrLf > > $Msg &= ' Subject: ' & $OutMsg.Subject & @CrLf > > MsgBox(0,$MsgTitle, 'FaxDevice' & @CrLf & $Msg) > > endfunc > > > > ;Display Outgoing Archive object Info > > func DisplayOutArchiveInfo($FaxOutArchive) > > local $Msg = 'Outgoing Archive Info:' & @CrLf > > $Msg &= ' AgeLimit: ' & $FaxOutArchive.AgeLimit & @CrLf > > $Msg &= ' ArchiveFolder: ' & $FaxOutArchive.ArchiveFolder & @CrLf > > $Msg &= ' HighQuotaWaterMark: ' & > $FaxOutArchive.HighQuotaWaterMark > > & @CrLf > > $Msg &= ' LowQuotaWaterMark: ' & $FaxOutArchive.LowQuotaWaterMark > & > > @CrLf > > $Msg &= ' Size: ' & Hex($FaxOutArchive.SizeHigh) & ':' & Hex > > ($FaxOutArchive.SizeLow) & @CrLf > > $Msg &= ' UseArchive: ' & ToBool($FaxOutArchive.UseArchive) & > @CrLf > > MsgBox(0,$MsgTitle, 'FaxDevice' & @CrLf & $Msg) > > endfunc > > > > ;Display Fax Server Info > > func DisplayFaxServerInfo($FaxServer) > > local $Msg = 'Fax Server Info:' & @CrLf > > $Msg &= ' API Version: ' & $FaxServer.APIVersion & @CrLf > > $Msg &= ' Debug: ' & $FaxServer.Debug & @CrLf > > $Msg &= ' Build and version: ' & $FaxServer.MajorBuild & '.' & > > $FaxServer.MajorVersion & '.' & $FaxServer.MinorVersion & @CrLf > > $Msg &= ' Server Name: ' & $FaxServer.ServerName & @CrLf > > MsgBox(0,$MsgTitle, 'FaxDevice' & @CrLf & $Msg) > > endfunc > > > > func ToBool($v) > > if $v = -1 then return TRUE > > return FALSE > > endfunc > > > > Thus, you can easy get tiff images (faxes) from outgoingArchive > > archive. > > > > Valery > > > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > > > > > Hi, > > > > > > > > Early I had problems with fax sending but today my fax device > is > > > > working fine (ACorp modem - $20). So I want to automate it's > hard > > > job > > > > by AutoIt. > > > > > > > > This is first simple AutoFax script which can connect to my > > > FaxServer > > > > and show it's options: > > > > > > > > ; Important note: > > > > ; Minimum operating systems Windows XP, Windows Server 2003 > > > > > > > > Global $FaxServer, $FaxActivity, $FaxDevices, $FaxDevice > > > > Dim $MsgTitle = 'Fax Sample' > > > > > > > > $FaxServer = ObjCreate('FaxComEx.FaxServer') > > > > if Not IsObj($FaxServer) then > > > > MsgBox(0,$MsgTitle, 'FaxServer was not created!') > > > > exit > > > > endif > > > > > > > > ; Connect to the local fax server. > > > > $FaxServer.Connect('') > > > > if @Error then > > > > MsgBox(0,$MsgTitle, 'FaxServer was not connected!') > > > > exit > > > > endif > > > > MsgBox(0,$MsgTitle, 'FaxServer connected!') > > > > > > > > $FaxActivity = $FaxServer.Activity > > > > if Not IsObj($FaxActivity) then > > > > MsgBox(0,$MsgTitle, 'FaxActivity was not created!') > > > > exit > > > > endif > > > > MsgBox(0,$MsgTitle, 'FaxActivity created!') > > > > > > > > ;Refresh the activity object > > > > $FaxActivity.Refresh() > > > > > > > > ;Retrieves a list of fax devices > > > > $FaxDevices = $FaxServer.GetDevices() > > > > if Not IsObj($FaxDevices) then > > > > MsgBox(0,$MsgTitle, 'FaxDevices were not obtained!') > > > > exit > > > > endif > > > > > > > > MsgBox(0,$MsgTitle, 'FaxServer has ' & $FaxDevices.Count & ' > > > > devices..') > > > > > > > > $FaxDevice = $FaxDevices.Item(0) > > > > if Not IsObj($FaxDevice) then > > > > MsgBox(0,$MsgTitle, 'FaxDevice was not obtained!') > > > > exit > > > > endif > > > > > > > > $Msg = '' > > > > $Msg &= ' CSID: ' & $FaxDevice.CSID & @CrLf > > > > $Msg &= ' TSID: ' & $FaxDevice.TSID & @CrLf > > > > $Msg &= ' Description: ' & $FaxDevice.Description & @CrLf > > > > $Msg &= ' Name: ' & $FaxDevice.DeviceName & @CrLf > > > > $Msg &= ' Id: ' & $FaxDevice.Id & @CrLf > > > > $Msg &= ' PoweredOff: ' & $FaxDevice.PoweredOff & @CrLf > > > > $Msg &= ' ProviderUniqueName: ' & $FaxDevice.ProviderUniqueName > & > > > > @CrLf > > > > $Msg &= ' ReceiveMode: ' & $FaxDevice.ReceiveMode & @CrLf > > > > $Msg &= ' SendEnabled: ' & $FaxDevice.SendEnabled & @CrLf > > > > > > > > MsgBox(0,$MsgTitle, 'FaxDevice' & @CrLf & $Msg) > > > > > > > > Enjoy, > > > > Valery > > > > > > > > PS. Really my goal is to extract TIFF image from Fax device. I > > > would > > > > like to use this weird method to convert any text documents > into > > > > image form. > > > > :-) > > > > > > > > > >