Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to track an incoming fax

Keywords:    

Question:

Can WinBatch track a fax for me? I need to know if it could read the screen to tell me when the fax message says it's done receiving, or if the com line was finished receiving, or a file was written to disk.

Answer:

To determine if the fax message says it's done receiving:
	
 msg = MsgTextGet("My Fax") ; Substitute your particular app name for "My Fax"
 If msg == "Fax Receive Complete" then WinClose("My Fax") ;or SendKey or...
To determine if the com line was finished receiving:
 ErrorMode(@OFF)

 :FaxNotDone
 PortBusy = FileOpen("COM1","READ") ;Use your port for COM1
 If PortBusy == 0 Then Delay(10)
 Then GoTo FaxNotDone
 FileClose(PortBusy)
 ErrorMode(@CANCEL)
To determine if a file was written to disk:
 DaFax = FileItemize("c:\fax\inbox\*.rec") ;use extension for received fax
 HowManyFax = Itemcount(DaFax," ")
 Run("c:\fax\FaxProg.EXE","poll")

 :FaxNotHere
 Delay(30)
 NewFaxIn = FileItemize(""c:\fax\inbox\*.rec"")
 If !(ItemCount(NewFaxIn)) > HowManyFax Then GoTo FaxNotHere
The above will tell you if a new file has been opened, but will loop forever if you don't get a new file. A multipage fax would give more than one file, so once you have *one* file, check again for page 2. Also, you should check the file size before closing the fax program.
Article ID:   W13188
Filename:   Track an incoming fax.txt