home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / ppstpx.zip / OM8.TPX < prev    next >
Text File  |  1993-06-08  |  28KB  |  566 lines

  1. #!-------------------------------------------------------------------------------#!
  2. #!      OM8.TPX
  3. #!
  4. #!      File      Select a file from a directory listing
  5. #!      Redirect  Select destination for a report
  6. #!      View      View a selected text file in a listbox
  7. #!
  8. #!------------------------------------------------------------------------------
  9. #!
  10. #!                      The File Template
  11. #!
  12. #!  The File template creates a procedure to allow a user to select a file.
  13. #!  The file name with its full path will be saved in the variable entered
  14. #!  at the 'Filename Variable' prompt.  If this field is left blank the
  15. #!  default of GLO:Filespec is used.  (GLO:Filespec has been entered in
  16. #!  Clarion's Default Application file for your convenience.  It will be
  17. #!  Smart-linked out of your final .EXE if not used.)
  18. #!
  19. #!  If a Next Procedure is requested (ie: a procedure created with the View
  20. #!  template) it will be called just prior to returning to the calling
  21. #!  procedure.
  22. #!
  23. #!------------------------------------------------------------------------------
  24. #!
  25. #PROCEDURE(File,'Select a file from a directory listing'),SCREEN
  26. #!
  27. #!------------------------------------------------------------------------------
  28. #PROTOTYPE('')
  29. #MAP('GETDIR.INC')
  30. #DISPLAY(' ')
  31. #PROMPT('Filename &Variable',FIELD),%SaveFilenameVar
  32. #PROMPT('Initial Directory',@S30),%StartDir
  33. #PROMPT('Beginning File Mask',@S6),%StartMask
  34. #PROMPT('Next Procedure',PROCEDURE),%NextProcedure
  35. #PROMPT('Reselect Upon Return',CHECK),%AllowReselect
  36. #PROMPT('Blank Name On Cancel',CHECK),%ClearOnCancel
  37.  
  38. #INSERT(%StandardHeader)
  39. #INSERT(%SetFileSymbols)
  40.  
  41. %Procedure       PROCEDURE
  42.  
  43. #INSERT(%LocalPPSVariables)                    #<! Declare Variables PPS
  44.  
  45. %LocalData
  46. %ScreenStructure
  47.  
  48. DirString   CSTRING(64)                          !Used for Directory to search
  49. SaveDir     LIKE(DirString)                      !Used to hold beginning path
  50.  
  51. DirInfo       GROUP                              !Necessary DOS file group
  52.                BYTE,DIM(21)                      ! Used by nextdir
  53. Attrib         BYTE                              ! Attribute in DOS format
  54. DosTime        SHORT                             ! Time in DOS format
  55. DosDate        SHORT                             ! Date in DOS format
  56. Filesize       LONG                              ! Size in BYTES
  57. FileName       CSTRING(13)                       ! File name
  58.              .                                   !End GROUP
  59.  
  60. #EMBED('Data Section')
  61.  
  62.   CODE
  63.   ProcedureName = '%Procedure'                 #<!Fill ProcedureName var. PPS
  64.   #EMBED('Setup Procedure')
  65.   #INSERT(%FileMgrStart)                       #<!Insert File Manager. PPS
  66.   OPEN(Screen)                                   !Open the screen
  67.   #IF(%StartMask)
  68.   FileMask = '%StartMask'                      #<!Set the begining file mask
  69.   #ELSE
  70.   FileMask = '*.*'                               !Set the begining file mask
  71.   #ENDIF
  72.   SaveDir = PATH()                               !Save the Starting Directory
  73.   IF LEN(CLIP(SaveDir)) <> 3                     !If we are not in the Root
  74.     SaveDir = CLIP(SaveDir) & '\'                ! add the trailing '\'
  75.   END                                            !End IF
  76.   #IF(%StartDir)
  77.   Directory = UPPER(%StartDir)                 #<!Change to the requested
  78.   SETPATH(Directory)                             ! Directory
  79.   Directory = PATH()                             ! And reread it.
  80.   IF LEN(CLIP(Directory)) <> 3                   !If we are not in the Root
  81.     Directory = CLIP(Directory) & '\'            ! add the trailing '\'
  82.   END                                            !End IF
  83.   #ELSE
  84.   Directory = SaveDir                            !Set to the Current Directory
  85.   #ENDIF
  86.   DO FillQueues                                  !Fill the screen queues
  87.   LOOP                                           !Main ACCEPT loop
  88.     #INSERT(%GenerateFormulas)
  89.     #EMBED('Top of Accept Loop')
  90.     CASE SELECTED()                            #<!Jump to field setup routine
  91.       #INSERT(%ScreenSetupRoutines)
  92.     END                                        #<!End CASE
  93.     ACCEPT                                       !Enable the keyboard
  94.  
  95.     CASE KEYCODE()
  96.   #FOR(%HotKey)
  97.     OF %HotKey                                 #<!User defined HotKey
  98.       %HotKeyProc                              #<!HotKey Procedure
  99.   #ENDFOR
  100.   #INSERT(%FileMgrView)                        #!Insert File Manager View PPS
  101.     END
  102.  
  103.     CASE FIELD()                                 !Jump to field edit routine
  104.     OF ?FileMask                                 !FieldMask field edit
  105.   #FIX(%ScreenField, '?FileMask')
  106.   #IF(%ScreenFieldEdit)
  107.         %ScreenFieldEdit                       #<! Insert button Edit Routine
  108.   #ENDIF
  109.       IF REFER()                                 !If something was touched
  110.         Do FillQueues                            ! Fill queues with new mask
  111.         SELECT(?FileList,1)                      !  for files, select line 1
  112.       END                                        !End IF
  113.     OF ?FileList                                 !FileList field Edit
  114.      Get(FileQueue,CHOICE())                     ! Get the selected entry
  115.   #FIX(%ScreenField, '?INSERT')
  116.   #IF(%ScreenFieldEdit)
  117.         %ScreenFieldEdit                       #<! Insert button Edit Routine
  118.   #ENDIF
  119.      IF KEYCODE() = MouseLeft2 OR |              ! On mouse double click
  120.         KEYCODE() = EnterKey                     !  Or the Enter Key
  121.        SELECT(?OK)                               !  Select the OK button and
  122.        PRESS(EnterKey)                           !  press Enter to complete
  123.      END                                         ! End IF
  124.   #IF(%DirQueueExists)
  125.     OF ?DirList                                  !Directory List field Edit
  126.     #FIX(%ScreenField, '?DirList')
  127.     #IF(%ScreenFieldEdit)
  128.         %ScreenFieldEdit                       #<! Insert button Edit Routine
  129.     #ENDIF
  130.       IF SELECTED() = ?DirList                   ! If selecting the same field
  131.         IF KEYCODE() = MouseLeft2 OR |           ! On mouse double click
  132.            KEYCODE() = EnterKey                  !  Or the Enter Key
  133.           GET(DirQueue,CHOICE())                 !  Get the selected entry
  134.           Directory = CLIP(Directory) & |        !  and create a new directory
  135.            DirLine                               !   with trailing \
  136.           SETPATH(Directory)                     !  Goto the directory
  137.           IF LEN(CLIP(PATH())) <> 3              !  If we are not in the Root
  138.             Directory = CLIP(PATH()) & '\'       !   Reread and add trailing \
  139.           ELSE                                   !  Else
  140.             Directory = PATH()                   !   Reread the direcrory
  141.           END                                    !  End IF
  142.           Do FillQueues                          !  Fill the screen queues
  143.           SELECT(?FileList,1)                    !  Reset File Listbox pointer
  144.           SELECT(?DirList,1)                     !  Reset Dir Listbox pointer
  145.         END                                      ! End IF
  146.       END                                        !End IF
  147.   #ENDIF
  148.     OF ?Ok                                       !Ok button field Edit
  149.   #FIX(%ScreenField, '?Ok')
  150.   #IF(%ScreenFieldEdit)
  151.         %ScreenFieldEdit                       #<! Insert button Edit Routine
  152.   #ENDIF
  153.       IF FileLine = '  NO MATCH     '            ! If no FileName selected
  154.   #IF(%DirQueueExists)
  155.         SELECT(?DirList)                         !  Select the directory List
  156.   #ELSE
  157.         SELECT(?Cancel)                          !  Select the directory List
  158.   #ENDIF
  159.         CYCLE                                    !  and cycle to ACCEPT.
  160.       END                                        ! End IF
  161.       %SaveFilenameVar = CLIP(Directory) & FileLine #<! Save the Filename
  162.   #IF(%NextProcedure)
  163.       SETPATH(SaveDir)                           ! Return to starting path
  164.     #IF(%DirQueueExists)
  165.       FREE(DirQueue)                             ! Free the DirQueue memory
  166.     #ENDIF
  167.       FREE(FileQueue)                            ! Free the FileQueue memory
  168.       %NextProcedure                           #<! Call the Next procedure
  169.     #IF(%AllowReselect)
  170.       DO FillQueues                              !Fill the screen queues
  171.       SELECT(?FileList)                          !Select the file list
  172.       CYCLE                                      !Return to Accept
  173.     #ENDIF
  174.   #ELSE
  175.       BREAK
  176.   #ENDIF
  177.     OF ?Cancel                                   !Cancel button field Edit
  178.   #FIX(%ScreenField, '?Cancel')
  179.   #IF(%ScreenFieldEdit)
  180.       %ScreenFieldEdit                         #<! Insert button Edit Routine
  181.   #ENDIF
  182.       SETPATH(SaveDir)                           ! Return to starting path
  183.   #IF(%DirQueueExists)
  184.       FREE(DirQueue)                             ! Free the DirQueue memory
  185.   #ENDIF
  186.       FREE(FileQueue)                            ! Free the FileQueue memory
  187.   #IF(%ClearOnCancel)
  188.       CLEAR(%SaveFilenameVar)                  #<! Clear the filename variable
  189.   #ENDIF
  190.       BREAK                                      ! Return to Calling Procedure
  191.     END                                          ! End CASE FIELD()
  192.   END                                            !End LOOP
  193.   SETPATH(SaveDir)                               ! Return to starting path
  194.   #IF(%DirQueueExists)
  195.   FREE(DirQueue)                                 ! Free the DirQueue memory
  196.   #ENDIF
  197.   FREE(FileQueue)                                ! Free the FileQueue memory
  198.   #INSERT(%FileMgrExit)                        #!Insert File Manager Exit PPS
  199.  
  200.  
  201.  
  202. FillQueues  ROUTINE
  203.  
  204.   FREE(FileQueue)                                !Clear the FileQueue
  205. #IF(%DirQueueExists)
  206.   FREE(DirQueue)                                 !Clear the DirQueue
  207.   DirString = CLIP(Directory) & '*.*'            !Set the subdirectory mask
  208.   IF SETDIR(DirString,DirInfo,FA_DIREC) <> 0 !If unexpected error
  209.     FREE(DirQueue)                               !Clear the DirQueue
  210.     FREE(FileQueue)                              !Clear the FileQueue
  211.     RETURN                                       ! Return
  212.   END                                            !End IF
  213.   LOOP                                           !While entries found
  214.     IF FileName = '.'                            ! If the dot entry
  215.       IF NEXTDIR(DirInfo) <> 0               !  Get the next entry
  216.         BREAK                                    !   Break if unexpected error
  217.       END                                        !  End IF
  218.     END                                          ! End IF
  219.     IF BAND(ATTRIB,10H)                          ! If a subdirectory is found
  220.       IF FileName = '..'                         !  If Previous dir entry
  221.         DirLine = '..\'                          !   Add a backslash
  222.       ELSE                                       !  Else
  223.         DirLine = FileName                       !   Fill the queue field
  224.       END                                        !  End IF
  225.       ADD(DirQueue)                              !  Add to the DirQueue
  226.       IF ERRORCODE() THEN BREAK.                 !  Break if unexpected error
  227.     END                                          ! End IF
  228.     IF NEXTDIR(DirInfo) <> 0                 ! Get the next entry
  229.       BREAK                                      !  Break if unexpected error
  230.     END                                          ! End IF
  231.   END                                            !End LOOP
  232.   SORT(DirQueue,+DirLine)                        !Sort the directory listing
  233. #ENDIF
  234.   DirString=CLIP(Directory) & FileMask           !Set the file mask
  235.   IF SETDIR(DirString,DirInfo,FA_NORMAL) <> 0 !If no matching files found
  236.     FileLine = '  NO MATCH  '                    ! Fill queue with message
  237.     ADD(FileQueue)                               ! Add it to the FileQueue
  238.   Else                                           !else matching file found
  239.     LOOP                                         ! While entries are found
  240.       IF BAND(ATTRIB,10H) = 0                    !  If entry is a file
  241.         FileLine = FileName                      !   Fill the queue field and
  242.         ADD(FileQueue)                           !   Add to the FileQueue
  243.         IF ERRORCODE() THEN BREAK.               !   Break if unexpected error
  244.       END                                        !  End IF
  245.       IF NEXTDIR(DirInfo) <> 0               !  Get the next entry
  246.         BREAK                                    !   Break if unexpected error
  247.       END                                        !  End IF
  248.     END                                          ! End LOOP
  249.   END                                            !End IF
  250.   SORT(FileQueue,+FileLine)                      !Sort the file listing
  251.   DISPLAY                                        !Display the new lists
  252.  
  253. #!
  254. #!***************************************************************************
  255. #PROCEDURE(Redirect,'Select destination for a report'),SCREEN
  256. #!------------------------------------------------------------------------------
  257. #!
  258. #!                           The Redirect Template
  259. #!
  260. #!------------------------------------------------------------------------------
  261. #PROTOTYPE('')
  262. #INSERT(%StandardHeader)
  263. %Procedure       PROCEDURE
  264.  
  265. #INSERT(%LocalPPSVariables)                    #<! Declare Variables PPS
  266.  
  267. %LocalData
  268. %ScreenStructure
  269. #EMBED('Data Section')
  270.  
  271.   CODE
  272.   ProcedureName = '%Procedure'                 #<!Fill ProcedureName var. PPS
  273.   #EMBED('Setup Procedure')
  274.   #INSERT(%FileMgrStart)                       #<!Insert File Manager. PPS
  275.   OPEN(Screen)
  276.   #EMBED('Setup Screen')
  277.   LOOP
  278.     #INSERT(%GenerateFormulas)
  279.     #EMBED('Top of Accept Loop')
  280.   #FOR(%ScreenField)
  281.     #IF(%ScreenFieldSetup)
  282.     CASE SELECTED()                            #<!Jump to field setup routine
  283.     #INSERT(%ScreenSetupRoutines)
  284.     END                                        #<!End CASE
  285.     #ENDIF
  286.   #ENDFOR
  287.     ACCEPT                                       !Accept input
  288.   #FOR(%HotKey)
  289.     CASE KEYCODE()
  290.     #FOR(%HotKey)
  291.     OF %HotKey                                 #<!User defined HotKey
  292.       %HotKeyProc                              #<!HotKey Procedure
  293.     #ENDFOR
  294.     #INSERT(%FileMgrView)                      #!Insert File Manager View PPS
  295.     END
  296.     #BREAK
  297.   #ENDFOR
  298.  
  299.     CASE FIELD()
  300.     #FOR(%ScreenField)
  301.     OF %ScreenField
  302.       %ScreenFieldEdit
  303.     #ENDFOR
  304.     END
  305.   END
  306. #EMBED('End of Procedure')
  307. #INSERT(%FileMgrExit)                          #!Insert File Manager Exit PPS
  308. #!
  309. #!
  310. #PROCEDURE(View,'View a selected text file in a listbox'),SCREEN,REPORT,PULLDOWN
  311. #!------------------------------------------------------------------------------
  312. #!
  313. #!                           The View Template
  314. #!
  315. #!------------------------------------------------------------------------------
  316. #PROTOTYPE('')
  317. #PROJECT('%clapfx%ASCII.LIB')
  318. #INSERT(%StandardHeader)
  319. #DISPLAY(' ')
  320. #PROMPT('File to &View',@s30),%ListFile
  321. #PROMPT('Warning Size (in K)',@s6),%FileWarningSize
  322. #PROMPT('Ma&ximum Line Length',@s6),%FileLineLength
  323. #PROMPT('Progress &Indicator',CHECK), %ShowProg
  324. #PROMPT('Progress Character',@S8),%ProgChar
  325. #!
  326. #IF(%ListFile = %Null)
  327.   #SET(%ListFile, 'GLO:FileSpec')
  328. #ENDIF
  329.  
  330. %Procedure       PROCEDURE
  331.  
  332. #INSERT(%LocalPPSVariables)                    #<! Declare Variables PPS
  333.  
  334. %LocalData
  335. SaveRows         BYTE                            !Initial screen rows
  336. SaveCols         BYTE                            !Initial screen columns
  337. FirstPage        BYTE
  338. RptFile          FILE,DRIVER('ASCII'),NAME(%ListFile),PRE(Dos) #<! Declare Input File
  339.                    RECORD
  340. Fline                STRING(255)
  341.                  . .
  342.  
  343. %ReportStructure
  344. %ScreenStructure
  345. %PulldownStructure
  346. #IF(%ShowProg)
  347. VEW::Length      BYTE                            ! Progress variable
  348. VEW::ProgString  STRING('{50}')                 ! Progress display variable
  349. #ENDIF
  350. #EMBED('Data Section')
  351.  
  352.   CODE
  353.   ProcedureName = '%Procedure'                 #<!Fill ProcedureName var. PPS
  354.   #EMBED('Setup Procedure')
  355.   #INSERT(%FileMgrStart)                       #<!Insert File Manager. PPS
  356.   #IF(%ProgChar)                                #!If showing the progress
  357.   VEW::ProgString = ALL(%ProgChar)             #<!Fill the progress string
  358.   #ENDIF
  359.   IF NOT %ListFile THEN RETURN.                #<!If %ListFile is blank
  360.   OPEN(RptFile)                                  !Open the Dos File
  361.   IF DiskError('Cannot Locate Selected File') THEN RETURN.
  362.   #IF(%FileWarningSize)
  363.   IF Bytes(RptFile) > (%FileWarningSize * 1024)#<! If oversized file
  364.     GLO:Message1 = 'This is a large file and may take a while'
  365.     GLO:Message2 = 'to load.  You may press the Esc key'
  366.     GLO:Message3 = 'while the file is loading to exit.'
  367.     ShowWarning                                  ! Show a warning screen
  368.   END                                            !End IF
  369.   #ENDIF
  370.   OPEN(Screen)                                   !Open the Screen
  371.   DISABLE(?PrintDevice)                          !Disable the device field
  372.   #IF(%Pulldown)                                #!If a Pulldown exists
  373.   OPEN(%Pulldown)                              #<!Open the Pulldown
  374.   #ENDIF
  375.   SaveRows = Rows(SCREEN)                        !Save the Screen Rows
  376.   SaveCols = Cols(SCREEN)                        !Save the Screen Columns
  377.   #EMBED('Setup Screen')
  378.   FirstPage = 1                                  !Set flag for Page 1
  379.   SET(RptFile)                                   !Set to the file
  380.   LOOP                                           !Loop through the dos file
  381.     #INSERT(%GenerateFormulas)
  382.     #EMBED('Top of Accept Loop')
  383.     NEXT(RptFile)                                ! Get the next record
  384.     IF ERRORCODE() THEN BREAK.                   !
  385.   #IF(%FileLineLength)
  386.     IF Bytes(RptFile) > %FileLineLength          ! Line is longer than allowed
  387.       GLO:Message1 = 'The line length is greater than %FileLineLength.'
  388.   #ELSE
  389.     IF Bytes(RptFile) > 255                      ! Line is longer than allowed
  390.       GLO:Message1 = 'The line length is greater than 255.'
  391.   #ENDIF
  392.       GLO:Message2 = 'The selected file is not an ASCII file.'
  393.       GLO:Message3 = 'No view on this file is available.'
  394.       ShowWarning                                ! Show an error message
  395.       FREE(ListQueue)                            ! Free memory table
  396.       CLOSE(RptFile)                             ! Close the DOS file
  397.   #IF(%Pulldown)                                #!If a Pulldown exists
  398.       CLOSE(%Pulldown)                         #<!Close the Pulldown
  399.   #ENDIF
  400.       CLOSE(SCREEN)                              ! Close the Screen
  401.       #EMBED('Immediately before RETURN for non-ASCII file error')
  402.       RETURN                                     ! Return back to caller
  403.     END                                          !End IF
  404.   #IF(%ShowProg)                                #!If showing the progress
  405.     #INSERT(%ShowProgress)
  406.   #ENDIF
  407.     #EMBED('After NEXT in RptFile LOOP')
  408.     Que:QueueLine = Dos:Fline                    ! Fill the queue line.
  409.     ADD(ListQueue)                               ! Add to the queue
  410.     IF ERRORCODE()                               ! If out of memory
  411.       GLO:Message1 = 'Error: ' & ERROR()         !
  412.       GLO:Message2 = 'This file is too large to be read into memory.'
  413.       GLO:Message3 = 'The entire file will not be displayed.'
  414.       ShowWarning                                !  Show an error message
  415.       BREAK                                      !  Break out of read loop
  416.     END                                          ! End IF
  417.  
  418.     IF FirstPage                                 ! If page 1
  419.       IF RECORDS(ListQueue) = ROWS(SCREEN)       !  If we have a full screen
  420.         FirstPage = 0                            !   turn off the page flag
  421.         DISPLAY                                  !   and display page 1
  422.       END                                        !  End IF
  423.     END                                          ! End IF
  424.     LOOP WHILE KEYBOARD()                        ! While Keyboard Input
  425.       SELECT(?List)                              !  Select the List box
  426.       ACCEPT                                     !  Handle internal keystrokes
  427.     END                                          ! End LOOP
  428.     IF KEYCODE() = EscKey THEN BREAK.
  429.   END                                            !End LOOP
  430.   StatusLine = 'Viewing: ' & %ListFile         #<! fill the statusline
  431.   DISPLAY                                        !Display the screen
  432.   LOOP                                           !Process the screen
  433.   #FOR(%ScreenField)
  434.     #IF(%ScreenFieldSetup)
  435.     CASE SELECTED()                            #<!Jump to field setup routine
  436.     #INSERT(%ScreenSetupRoutines)
  437.     END                                        #<!End CASE
  438.     #ENDIF
  439.   #ENDFOR
  440.     ACCEPT                                       !Accept input
  441.   #FOR(%HotKey)
  442.     CASE KEYCODE()
  443.     #FOR(%HotKey)
  444.     OF %HotKey                                 #<!User defined HotKey
  445.       %HotKeyProc                              #<!HotKey Procedure
  446.     #ENDFOR
  447.     #INSERT(%FileMgrView)                      #!Insert File Manager View PPS
  448.     END
  449.     #BREAK
  450.   #ENDFOR
  451.     CASE FIELD()                                 !Which field was completed
  452.   #FOR(%ScreenField)
  453.     #IF(%ScreenField = '?Exit')
  454.     OF ?Exit                                     !Completed Exit Button
  455.       %ScreenFieldEdit                         #<! Insert Edit Routine
  456.       BREAK                                      ! Break out of the loop
  457.     #ELSIF(%ScreenField = '?ChangeMode')
  458.     OF ?ChangeMode                               !Completed mode button
  459.       IF ROWS(SCREEN) = 25                       ! If in 25 line mode
  460.         CLOSE(SCREEN)                            !  Close the current screen
  461.         SETTEXT(50,80)                           !  Set to 50 line mode
  462.       ELSE                                       ! Else in 43 or 50 line mode
  463.         CLOSE(SCREEN)                            !  Close the current screen
  464.         SETTEXT(25,80)                           !  Set to 25 line mode
  465.         SETAREA(25,80)                           !  Resize the screen area
  466.         LOADSYMBOLS                              !  Reload graphic mouse
  467.       END                                        ! End IF
  468.       OPEN(SCREEN)                               !  Open screen in new mode
  469.       DISABLE(?PrintDevice)                      !  Disable the device field
  470.       DISPLAY                                    !  Display the fields
  471.       %ScreenFieldEdit                         #<! Insert Edit Routine
  472.     #ELSIF(%ScreenField = '?Print')
  473.     OF ?Print                                    !Completed Print Button
  474.       %ScreenFieldEdit                         #<! Insert Edit Routine
  475.       IF NOT PrintDevice                         ! If no print device selected
  476.         DISABLE(?StatusLine)                     !  Disable the StatusLine
  477.         ENABLE(?PrintDevice)                     !  Enable the PrintDevice
  478.         SELECT(?PrintDevice)                     !  Select the PrintDevice
  479.         CYCLE                                    !  Cycle to accept input
  480.       END                                        ! End IF
  481.       IF NOT STATUS(PrintDevice)                 ! Check PrintDevice status
  482.         GLO:Message1 = CLIP(PrintDevice) & ' is not ready.'
  483.         GLO:Message2 = 'Be sure the Printer is online and attached to'
  484.         GLO:Message3 = 'the specified device and try again.'
  485.         ShowWarning                              !  Show an error message
  486.         PrintDevice = ''                         !  Clear the PrintDevice
  487.         CYCLE                                    !  Cycle to accept input
  488.       END                                        ! End IF
  489.       OPEN(REPORT)                               ! Open the report to print
  490.       LOOP I# = 1 to RECORDS(ListQueue)          ! Loop while QUEUE records
  491.         GET(ListQueue,I#)                        !  Get the line
  492.         IF ERRORCODE() THEN BREAK.               !  Break if an error occurs
  493.         PRINT(RPT:Detail)                        !  Print the line
  494.         IF KEYBOARD()                            !  If keyboard input
  495.           ACCEPT                                 !   Get the keystroke
  496.           IF KEYCODE() = EscKey                  !   If the ESCAPE key
  497.             BREAK                                !    Break from printing
  498.           END                                    !   End IF
  499.         END                                      !  End IF
  500.       END                                        ! End LOOP
  501.       CLOSE(REPORT)                              ! Close the report
  502.       PrintDevice = ''                           ! Clear the printer variable
  503.     #ELSIF(%ScreenField = '?PrintDevice')
  504.     OF ?PrintDevice                              !Selected a port for printer
  505.       %ScreenFieldEdit                         #<! Insert Edit Routine
  506.       DISABLE(?PrintDevice)                      !  Disable the PrintDevice
  507.       ENABLE(?StatusLine)                        !  Enable the StatusLine
  508.       SELECT(?Print)                             !  Select the Print button
  509.       PRESS(EnterKey)                            !  And complete it.
  510.     #ELSIF(%ScreenFieldEdit)
  511.     OF %ScreenField
  512.       %ScreenFieldEdit
  513.     #ENDIF
  514.   #ENDFOR
  515.     #INSERT(%PulldownEditRoutines)
  516.     END                                          ! End CASE FIELD()
  517.   END                                            !End LOOP
  518.   #EMBED('Immediately after LOOP, before FREE(Queue)')
  519.   FREE(ListQueue)                                !Free memory table
  520.   CLOSE(RptFile)                                 !Close the DOS file
  521.   #IF(%Pulldown)                                #!If a Pulldown exists
  522.   CLOSE(%Pulldown)                             #<!Close the Pulldown
  523.   #ENDIF
  524.   CLOSE(SCREEN)                                  !Close the Screen
  525.   IF Rows(SCREEN) <> SaveRows |                  !If the mode is not the same
  526.       OR SaveCols <> Cols(SCREEN)                !as when we entered
  527.     SETTEXT(SaveRows,SaveCols)                   ! Reset to the entry mode
  528.     SETAREA(SaveRows,SaveCols)                   ! Resize the screen area
  529.     LOADSYMBOLS                                  ! Reload graphic mouse
  530.   END                                            !End IF
  531. #EMBED('End of Procedure')
  532. #INSERT(%FileMgrExit)                          #!Insert File Manager Exit PPS
  533. #!
  534. #!***************************************************************************
  535. #GROUP(%ShowProgress)
  536. IF NOT (((POINTER(RptFile)+100)%%100))           !Show the progess indicator
  537.   VEW::Length += 1
  538.   StatusLine = ' Reading File: ' & SUB(VEW::ProgString,1,VEW::Length)
  539.   IF VEW::Length = 50
  540.     VEW::Length = 1
  541.     StatusLine = ' Reading File: ' & ' {70}'
  542.   END
  543.   Display(?StatusLine)
  544. END
  545. #!
  546. #!***************************************************************************
  547. #!
  548. #GROUP(%SetFileSymbols)
  549. #IF(%SaveFilenameVar = %Null)
  550.   #SET(%SaveFilenameVar, 'GLO:FileSpec')
  551. #ENDIF
  552.   #SET(%DirQueueExists,%Null)
  553.   #SET(%FileMaskExists,%Null)
  554.   #SET(%DirectoryExists,%Null)
  555.   #FOR(%ScreenField)
  556.     #IF(UPPER(%ScreenField) = '?DIRLIST')
  557.       #SET(%DirQueueExists,'YES')
  558.     #ELSIF(UPPER(%ScreenField) = '?FILEMASK')
  559.       #SET(%FileMaskExists,'YES')
  560.     #ELSIF(UPPER(%ScreenField) = '?DIRECTORY')
  561.       #SET(%DirectoryExists,'YES')
  562.     #ENDIF
  563.   #ENDFOR
  564. #!
  565. #CHAIN('OM9.TPX')
  566.