home *** CD-ROM | disk | FTP | other *** search
- *.............................................................................
- * Program Name: FOXFAX04.PRG Copyright: Magna Carta Software, Inc.
- * Date Created: 03-03-91 Language: FoxPro v2.x.
- *.............................................................................
- * Description: CAS Current Event status utility.
- * Reads a CAS log file and displays it on the screen.
- *.............................................................................
- SET TALK OFF
- CLEAR
-
-
- * Load the right library
- foxid = VERS()
- IF "2.0" $ foxid
- SET LIBR TO ftf && Identified FoxPro 2.0
- ELSE
- IF "2.5" $ VERS()
- IF "Windows" $ foxid && Identified FoxPro 2.5 for Windows
- SET LIBR TO ftfw
- ELSE
- SET LIBR TO ftf25 && Identified FoxPro 2.5 for DOS
- ENDIF
- ENDIF
- ENDIF
-
- DO ftfhdr
-
- PUBLIC status, ret, tmp
-
-
- IF FILE('temp0000.tcf')
- tmp = FOPEN('castmp.txt', 0)
- ELSE
- CANCEL
- ENDIF
- @01, 00 SAY "fopen=" + ALLTRIM(STR(tmp))
- status = FREAD(tmp, 512)
- =display_fax(status)
- DONE = .F.
- DO WHILE !DONE
- IF INKEY() = CR
- DONE = .T.
- ENDIF
- ENDDO
- ret =FCLOSE(tmp)
- ? ret
-
-
-
- PROCEDURE display_fax
- PARAMETERS s
-
- DIMENSION event_type[5], transfer_type[3], event_status[6], ftype[3]
- DIMENSION fstatus[5]
- PRIVATE etype, hours, mins, secs, tpage, pages, files, ro
- PRIVATE lcol1, lcol2, lcol3, lcol4, c, pa, timestr
- PRIVATE csid, errors, edate, etime
-
- ro = 2
- lcol1 = 3
- lcol2 = 35
- lcol3 = 44
- lcol4 = 71
- event_type[1] = "Send"
- event_type[2] = "Receive"
- event_type[3] = "Polled Send"
- event_type[4] = "Polled Receive"
- event_type[5] = "Hardware Error"
-
- transfer_type[1] = "200x200 dpi Fax mode"
- transfer_type[2] = "100x200 dpi Fax mode"
- transfer_type[3] = "File transfer mode"
-
- event_status[1] = "Successfully completed"
- event_status[2] = "Waiting to be processed"
- event_status[3] = "Number has been dialled"
- event_status[4] = "Connection made -- sending"
- event_status[5] = "Connection Made -- receiving"
- event_status[6] = "Event was aborted"
-
- ftype[1] = "ASCII"
- ftype[2] = "PCX"
- ftype[3] = "DCX"
-
- fstatus[1] = "Untouched"
- fstatus[2] = "Has been opened"
- fstatus[3] = "Has been moved"
- fstatus[4] = "Has been deleted"
- fstatus[5] = "Not yet received"
-
- * DISPLAY THE EVENT TYPE
- c = ASC(SUBSTR(s, 1, 1))
- etype = c
- @ro, lcol1 SAY "Event type: "
- IF c >= 0 .AND. c <= 3
- @ro, lcol2 SAY event_type[c+1]
- ELSE
- @ro, lcol2 SAY c
- ENDIF
- ro = ro+1
-
- * DISPLAY THE TRANSFER TYPE
- c = ASC(SUBSTR(s, 2, 1))
- @ro, lcol1 SAY "Transfer type: "
- IF c >= 0 .AND. c <= 2
- @ro, lcol2 SAY transfer_type[c+1]
- ELSE
- @ro, lcol2 SAY SUBSTR(s, 1, 64)
- ENDIF
- ro = ro+1
-
- * DISPLAY STATUS OF EVENT
- c = ASC(SUBSTR(s, 3, 1))
- @ro, lcol1 SAY "Status of event: "
- IF c >= 0 .AND. c <= 5
- @ro, lcol2 SAY event_status[c+1]
- ELSE
- @ro, lcol2 SAY SUBSTR(s, 3, 64)
- ENDIF
- ro = ro+1
-
- * IF A SEND EVENT DISPLAY DATE AND TIME
- IF etype == 0 .OR. etype == 2
- * CONVERT THE TIME TO A 2-BYTE INTEGER
- c = ASC(SUBSTR(s, 5, 1)) + ASC(SUBSTR(s, 6, 1)) * 256
- etime = DOST2XT(c)
- @ro, lcol1 SAY "Event time: "
- @ro, lcol2 SAY etime
- c = ASC(SUBSTR(s, 7, 1)) + ASC(SUBSTR(s, 8, 1)) * 256
- edate = DOSD2XD(c)
- @ro, lcol3 SAY "Event date: "
- @ro, lcol4-7 SAY DTOC(edate)
- * @ro, lcol4-7 SAY edate
- ENDIF
- ro = ro+1
-
- * DISPLAY NUMBER OF FILES TO TRANSFER
- c = SUBSTR(s, 9, 2)
- @ro, lcol1 SAY "Number of files to transfer: "
- @ro, lcol2 SAY LTRIM(STR(ASC(c)))
- ro = ro+1
-
- * DISPLAY PHONE NUMBER TO CALL
- c = STRTRAN(SUBSTR(s, 13, 47), CHR(0), CHR(32))
- @ro, lcol1 SAY "Phone number: "
- @ro, lcol2 SAY ALLTRIM(c)
- ro = ro+1
-
- * DISPLAY CONNECT TIME STATUS
- secs = SUBSTR("0" + ALLTRIM(STR(ASC(SUBSTR(s, 125, 1)))), 1, 2)
- mins = SUBSTR("0" + ALLTRIM(STR(ASC(SUBSTR(s, 126, 1)))), 1, 2)
- hours = SUBSTR("0" + LTRIM(STR(ASC(SUBSTR(s, 127, 1)))), 1, 2)
- timestr = hours + ":" + mins + ":" + secs
- @ro, lcol1 SAY "Connect Time: "
- @ro, lcol2 SAY timestr
- ro = ro+1
-
- * DISPLAY TRANSFER PROGRESS
- tpage = ASC(SUBSTR(s, 128, 4))
- @ro, lcol1 SAY "Number of pages to send: "
- @ro, lcol2 SAY LTRIM(STR(tpage))
- pages = ASC(SUBSTR(s, 132, 1))
- @ro, lcol3 SAY "Number of pages sent: "
- @ro, lcol4 SAY LTRIM(STR(pages))
- ro = ro+1
- files = ASC(SUBSTR(s, 136, 2))
- @ro, lcol1 SAY "Number of files sent: "
- @ro, lcol2 SAY LTRIM(STR(files))
- errors = ASC(SUBSTR(s, 139, 2))
- @ro, lcol3 SAY "Number of errors: "
- @ro, lcol4 SAY LTRIM(STR(errors))
- ro = ro+1
- csid = SUBSTR(s, 219, 21)
- @ro, lcol1 SAY "Remote CSID: "
- @ro, lcol2 SAY csid
- ro = ro+1
-
- * DISPLAY RECIPIENT NAME
- c = SUBSTR(s, 240, 32)
- @ro, lcol1 SAY "Recipient: "
- @ro, lcol2 SAY ALLTRIM(c)
- ro = ro+1
-
- * DISPLAY SENDER NAME
- c = SUBSTR(s, 272, 32)
- @ro, lcol1 SAY "Sender: "
- @ro, lcol2 SAY ALLTRIM(c)
- ro = ro+1
-
- * PCX LOGO FILE PATH AND NAME
- c = STRTRAN(SUBSTR(s, 304, 80), CHR(0), CHR(32))
- @ro, lcol1 SAY "PCX Logo File Path: "
- @ro, lcol2 SAY ALLTRIM(c)
- ro = ro+1
-
- * FTR FIELDS
- * FILE TYPE
- c = ASC(SUBSTR(s, 384, 1))
- @ro, lcol1 SAY "File type: "
- IF c >= 0 .AND. c <= 2
- @ro, lcol2 SAY ftype[c+1]
- ENDIF
- ro = ro+1
-
- * TEXT SIZE TO USE IF FILE TYPE IS ASCII
- c = ASC(SUBSTR(s, 385, 1))
- @ro, lcol1 SAY "Text size for ASCII faxes: "
- IF c == 0
- @ro, lcol2 SAY "80 col x 66 lines"
- ELSE IF c == 1
- @ro, lcol2 SAY "132 col x 66 lines"
- ENDIF
- ro = ro+1
-
- * STATUS OF THE FILE
- c = ASC(SUBSTR(s, 386, 1))
- @ro, lcol1 SAY "Status of this file: "
- IF c >= 0 .AND. c <= 4
- @ro, lcol2 SAY fstatus[c+1]
- ENDIF
- ro = ro+1
-
- * BYTES TRANSMITTED SO FAR
- c = ASC(SUBSTR(s, 387, 1)) + ASC(SUBSTR(s, 388, 1)) * 256 +;
- (ASC(SUBSTR(s, 389, 1)) + ASC(SUBSTR(s, 390, 1)) * 256) * 1024 * 64
- @ro, lcol1 SAY "Bytes transmitted so far: "
- @ro, lcol2 SAY ALLTRIM(STR(c))
- ro = ro+1
-
- * SIZE IN BYTES OF THIS FILE
- c = ASC(SUBSTR(s, 391, 1)) + ASC(SUBSTR(s, 392, 1)) * 256 +;
- (ASC(SUBSTR(s, 393, 1)) + ASC(SUBSTR(s, 394, 1)) * 256) * 1024 * 64
- @ro, lcol1 SAY "Size (in bytes) of file: "
- @ro, lcol2 SAY ALLTRIM(STR(c))
- ro = ro+1
-
- * FILE PAGES TRANSMITTED SO FAR
- c = ASC(SUBSTR(s, 395, 2))
- @ro, lcol1 SAY "Pages transmitted so far: "
- @ro, lcol2 SAY ALLTRIM(STR(c))
-
- * TOTAL FILE PAGES IN FILE
- c = ASC(SUBSTR(s, 397, 2))
- @ro, lcol3 SAY "Pages in file: "
- @ro, lcol4 SAY ALLTRIM(STR(c))
- ro = ro+1
-
- * PATH AND NAME OF FILE TO SEND
- c = STRTRAN(SUBSTR(s, 399, 80), CHR(0), CHR(32))
- @ro, lcol1 SAY "Full file path: "
- @ro, lcol2 SAY ALLTRIM(c)
- ro = ro+1
-
- * 1/8th INCH INCREMENTS IN PAGE LENGTH
- c = ASC(SUBSTR(s, 479, 1))
- @ro, lcol1 SAY 'No. of 1/8" incr. to length: '
- @ro, lcol2 SAY ALLTRIM(STR(c))
-
- * PAGE LENGTH
- pa = ASC(SUBSTR(s, 480, 1))
- @ro, lcol3 SAY "Page length (inches): "
- IF pa == -1
- @ro, lcol4 SAY "ASCII pages with form feeds"
- ELSE
- IF pa == 0
- @ro, lcol4 SAY "11"
- ELSE
- IF pa > 0
- pa = pa + c/8
- @ro, lcol4 SAY ALLTRIM(STR(pa))
- ENDIF
- ENDIF
- ENDIF
- RETURN
-