home *** CD-ROM | disk | FTP | other *** search
- *.............................................................................
- * Program Name: FOXFAX03.PRG Copyright: Magna Carta Software, Inc.
- * Date Created: 11-10-91 Language: FoxPro v2.x.
- *.............................................................................
- * Description: CAS Current Event status utility.
- * Run this while a CAS event is occuring.
- *.............................................................................
- SET TALK OFF
- CLOSE ALL
-
-
- * 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
-
- SET CURSOR off
- SET ESCAPE off
-
- DO ftfhdr
-
- CLEAR
- PUBLIC DONE, status, row, def_colors, scr, i, ro, ret
- PUBLIC ro, lcol1, lcol2, lcol3, lcol4
- lcol1 = 1
- lcol2 = 32
- lcol3 = 44
- lcol4 = 71
- ro = 0
-
- @ro, 00 SAY "FOXFAX03: Get Current Event Status"
- ro = ro+1
- status = SPACE(512)
- ret = cas_get_ces(@status)
- IF ret < 0
- @ro, 00 SAY "No events currently running (return code " + UPPER(D2X(abs(ret))) + "h)"
- ro = ro+1
- ELSE
- DEFINE WINDOW w_main FROM 01, 00 TO SROWS()-1, SCOLS()-1;
- IN SCREEN;
- TITLE " FoxFax03: CommTools - Fox Fax Status Utility " DOUBLE COLOR SCHEME 7
- ACTIVATE WINDOW w_main
- DONE = .F.
- DO WHILE !DONE
- status = SPACE(512)
- ret = cas_get_ces(@status)
- IF ret < 0
- ro = ro + 1
- @ro, 00 SAY "No events currently running (return code " + LTRIM(STR(ret)) + ")"
- DONE = .T.
- ELSE
- =display_control_file(status, 2)
- ENDIF
- IF INKEY() = ESC
- =cas_abort_current_event()
- @23, 40 SAY "Event aborted from keyboard"
- DONE = .T.
- ENDIF
- ENDDO
- ENDIF
- SET CURSOR ON
- RELEASE WINDOWS
- CLOSE ALL
-
-
- PROCEDURE display_control_file
- PARAMETERS s, ro
-
- DIMENSION event_type[5], transfer_type[3], event_status[6], ftype[3]
- DIMENSION fstatus[5]
- PRIVATE etype, hours, mins, secs, tpage, pages, files
- PRIVATE c, pa, timestr
- PRIVATE csid, errors, edate, etime
-
- 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)
- 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 = ASC(SUBSTR(s, 125, 1))
- IF secs < 10
- secs = SUBSTR("0" + ALLTRIM(STR(secs)), 1, 2)
- ELSE
- secs = SUBSTR(ALLTRIM(STR(secs)), 1, 2)
- ENDIF
- mins = ASC(SUBSTR(s, 126, 1))
- IF mins < 10
- mins = SUBSTR("0" + ALLTRIM(STR(mins)), 1, 2)
- ELSE
- mins = SUBSTR(ALLTRIM(STR(mins)), 1, 2)
- ENDIF
- hours = ASC(SUBSTR(s, 127, 1))
- IF hours < 10
- hours = SUBSTR("0" + ALLTRIM(STR(hours)), 1, 2)
- ELSE
- hours = SUBSTR(ALLTRIM(STR(hours)), 1, 2)
- ENDIF
- 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 SUBSTR(c, 1, AT(CHR(1), c, 1) - 1)
- 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
-
- =display_ftr(SUBSTR(s, 384, 128), ro)
- RETURN
-
-
- * DISPLAY_FTR -- Display a File Transfer Record (FTR).
- * While a generic routine, in this case the FTR returned by CAS_GET_CES()
- * is displayed.
- PROCEDURE display_ftr
- PARAMETERS s, ro
-
- * FILE TYPE
- c = ASC(SUBSTR(s, 1, 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, 2, 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, 3, 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, 4, 1)) + ASC(SUBSTR(s, 5, 1)) * 256 +;
- (ASC(SUBSTR(s, 6, 1)) + ASC(SUBSTR(s, 7, 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, 8, 1)) + ASC(SUBSTR(s, 9, 1)) * 256 +;
- (ASC(SUBSTR(s, 10, 1)) + ASC(SUBSTR(s, 11, 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, 12, 2))
- @ro, lcol1 SAY "Pages transmitted so far: "
- @ro, lcol2 SAY ALLTRIM(STR(c))
-
- * TOTAL FILE PAGES IN FILE
- c = ASC(SUBSTR(s, 14, 2))
- @ro, lcol3 SAY "Pages in file: "
- @ro, lcol4 SAY ALLTRIM(STR(c))
- ro = ro+1
-
- * PATH AND NAME OF FILE TO SEND
- c = SUBSTR(s, 16, 80)
- @ro, lcol1 SAY "Full file path: "
- @ro, lcol1+17 SAY SUBSTR(c, 1, AT(CHR(0), c, 1))
- ro = ro+1
-
- * 1/8th INCH INCREMENTS IN PAGE LENGTH
- c = ASC(SUBSTR(s, 97, 1))
- @ro, lcol1 SAY 'No. of 1/8" incr. to length: '
- @ro, lcol2 SAY ALLTRIM(STR(c))
-
- * PAGE LENGTH
- pa = ASC(SUBSTR(s, 98, 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
-
-