Jump to content

Monitor incoming FAX queque


Recommended Posts

My first post here, altough I've build all my knowledge in AutoIT thanks to this forum :)

I'll go straight to my case, hopefully someone can help me, current situation: I have an old MFP printer being used as fax server (Forward via mail all incoming faxes), I want to let a PC handle all the incoming faxes, instead of this printer.

I've already attached an USB Fax modem and wrote a script which scans every 10 secs the Inbox folder for any image and automatically forwards and archive everything.

I want to move a step further and add to the Forwarded Email more details such as FAX Sender / FAX Send Time & Date / Etc.

Every help is really appreciated!

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <OutlookEx.au3>

; Variable declarations
Local $FaxInboxDir = "C:\Users\xxxxx\Documents\Fax\Inbox"
Local $FaxArchiveDir = "K:\xxxxx\FAX"
Local $FaxLocalArchiveDir = "C:\Users\xxxxx\Documents\Fax\Local Archive"
Local $date = @YEAR & "-" & @MON & "-" & @MDAY

; Function to search for new faxes and archive them locally and on K:\ drive
Func ArchiveFax()
   ; Assign a Local variable the search handle of all files in the current directory.
   Local $hSearch = FileFindFirstFile($FaxInboxDir & "\*.tif")
   ; Check if the search was successful, if not write in the console a message and return False.
   If $hSearch = -1 Then
      _FileWriteLog(@ScriptDir & "\FAX_Handler_" & $date & ".log", "Non ci sono fax da spostare in archivio.")
      Return False
   EndIf
   ; Assign a Local variable the empty string which will contain the files names found.
   Local $sFileName = "", $iResult = 0
   While 1
      $sFileName = FileFindNextFile($hSearch)
      ; If there is no more file matching the search.
      If @error Then ExitLoop

      ; Forward the FAX via Mail
      $oOL = _OL_Open()
      _OL_Wrapper_SendMail($oOL, "xxxxx@gmail.com", "", "", "Subject: Test", "Body: Test", $FaxInboxDir&"\"&$sFileName)
      _OL_Close($oOL)

      ; Copy the fax file locally, on K:\ drive and write to the log.
      FileCopy($FaxInboxDir&"\"&$sFileName, $FaxLocalArchiveDir&"\"&$sFileName, $FC_OVERWRITE + $FC_CREATEPATH)
      FileMove($FaxInboxDir&"\"&$sFileName, $FaxArchiveDir, $FC_OVERWRITE + $FC_CREATEPATH)
      _FileWriteLog(@ScriptDir & "\FAX_Handler_" & $date & ".log", "Archiviato il file " & $sFileName)
   WEnd
   ; Close the search handle.
   FileClose($hSearch)
EndFunc   ;==>Example

While 1
   ArchiveFax()
   Sleep(10000)
WEnd

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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