home *** CD-ROM | disk | FTP | other *** search
- $COMPILE EXE
- $LIB ALL OFF
- DEFINT a-z
- $INCLUDE "SPOOLKIT.INC"
- $LINK "SPOOLKIT.PBU"
-
- DIM STATIC QueList$(32)
- CLS
- locate 4,1
- print TAB(28);" SpoolKit version 1.0 demo"
- print " "
- print "Testing for presence of DOS PRINT resident - ";
- IF SpoolInstalled% THEN
- PRINT "found it, SPKDEMO ready to go!"
- ELSE
- PRINT "spooler not installed, can't run demo"
- end
- END IF
-
- print "Press any key to begin the demo, or ESC to stop"
- CALL WaitForKey
- ' Part 1
- print " "
- print " "
- print "Part 1: Checking current contents of spool queue"
- print "This test simply lists the contents of the print spooler job queue"
- print " "
- CALL ListSpooledFiles(QueList$(),Count%,Stat%)
- IF Stat% <> 0 THEN
- print tab(10);"* Error number ";Stat%;" occurred, demo stopping"
- STOP
- END IF
- print TAB(10);" - Number of queued files: ";Count%
- IF Count% > 0 THEN
- FOR x% = 1 to Count%
- print TAB(15);QueList$(x%)
- NEXT x%
- END IF
-
- Print " "
- Print "Press any key for next step, ESC to stop demo"
- Call WaitForKey
-
- ' Part 2
-
- CLS
- LOCATE 4,1
- print "Part 2: Submit a file to print"
- print " "
- print "This test will submit a print file to the spooler. When asked for a"
- print "file name, give the path of a single file. For demonstration purpose,"
- print "a short file will work as good as a long one (i.e. C:\CONFIG.SYS)."
- print "If your printer is on-line and ready, the file should print."
- print " "
- Input "Enter name of file to print: ";a$
- CALL SubmitSpoolFile(a$,Count%,Stat%)
- SELECT CASE Stat%
- CASE 0
- print tab(10);Count%;" files successfully spooled"
- CASE 8
- print Tab(10);"Print spooler queue is full,";Count%;" files spooled"
- CASE ELSE
- print Tab(10);"Error number";Stat%;" occurred, demo stopping"
- STOP
- END SELECT
-
- Print " "
- Print "Press any key for next step, ESC to stop demo"
- Call WaitForKey
- CLS
- locate 4,1
- print "Part 3: Cancel a file from print queue"
- print " "
- print "This portion of the demo will queue several files to the spooler, then"
- print "ask you which one to remove from the spool queue. You will be asked to"
- print "take your printer off-line first, so that the files will not finish"
- print "printing while you are typeing your answers. This is an advantage to"
- print "using the DOS PRINT spooler. The PowerBasic programmer is relieved"
- print "from having to deal with the printer being offline, out of paper, etc"
- print " "
- print "Please take your printer off-line, press any key when done (ESC exits)"
- CALL WaitForKey
- print " "
- print "I now need you to supply a wild card file specification. All files"
- print "meeting the specification will be placed in the spool queue. Please"
- print "use a file spec that will cause more than one file to enter the queue"
- print "The demo will stop submitting files if the spooler queue fills up.
- print " "
- print "An example would be: C:\BIN\*.BAT"
- print " "
- line input "Please enter a file specification: ";x$
- print " "
- print "Queueing files . . .";
- CALL SubmitSpoolFile(x$,Count%,Stat%)
- SELECT CASE Stat%
- CASE 0
- print tab(10);Count%;" files successfully spooled"
- CASE 8
- print Tab(10);"Print spooler queue is full,";Count%;" files spooled"
- CASE ELSE
- print Tab(10);"Error number";Stat%;" occurred while submitting, demo stopping"
- STOP
- END SELECT
- CALL ListSpooledFiles(QueList$(),Count%,Stat%)
- IF Stat% <> 0 THEN
- print " * Error number ";Stat%;" occurred listing queue, can't continue"
- STOP
- END IF
- print "Press any key for a list of the contents of the PRINT queue (ESC quits)"
- CALL WaitForKey
- CLS
- locate 4,1
- print "List of";Count%;" queued files: "
- IF Count% > 0 THEN
- FOR x% = 1 to Count%
- print " ";QueList$(x%)
- NEXT x%
- END IF
-
- print " "
- print "We will now remove files from the queue. Enter the FULLY QUALIFIED"
- print "path and file name of the file or files to be removed for the queue"
- print "Wild cards are OK, but must include a drive/path specification"
- print " "
- line input "Please enter FULL specification of file to cancel: ";x$
- CALL RemoveFromSpool(x$,Stat%)
- SELECT CASE Stat%
- Case 0
- PRINT "Files successfully removed from queue"
- CALL ListSpooledFiles(QueList$(),Count%,Stat%)
- print "Press any key for new list of queued files. (ESC quits) "
- CALL WaitForKey
- print "PRINT queue contains";Count%;" files"
- IF Count% > 0 THEN
- FOR x% = 1 to Count%
- print " * ";QueList$(x%)
- NEXT x%
- END IF
- CASE 2,3,&H0C
- PRINT " * INVALID name given"
- CASE ELSE
- PRINT " * Error number ";Stat%;" occurred removeing file, demo stopping"
- STOP
- END SELECT
- Print " "
- Print "Press any key for next step, ESC to stop demo"
- Call WaitForKey
-
- CLS
- print " "
- print "Part 4: Cancel all jobs in print queue"
- print "This last portion will remove all remaining jobs from the spooler queue."
- print "Press any key to remove all files. (ESC Quits)"
- CALL WaitForKey
- print "Clearing PRINT queue."
- CALL CancelAllSpool(Stat%)
- CALL ListSpooledFiles(QueList$(),Count%,Stat%)
- print "List of queued files: "
- IF Count% > 0 THEN
- FOR x% = 1 to Count%
- print " * ";QueList$(x%)
- NEXT x%
- ELSE
- print " NONE!"
- END IF
-
- print TAB(10);"GoodBye from the SPOOLKIT demo!"
-
- end
-
- SUB WaitForKey
- WHILE NOT INSTAT:WEND
- a$ = inkey$
- IF a$ = CHR$(27) THEN
- locate 24,1
- print "Demo stopped at user request"
- STOP
- END IF
- END SUB