home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
pb
/
library2
/
dospool.bas
< prev
next >
Wrap
BASIC Source File
|
1990-07-08
|
4KB
|
158 lines
$link "dospool.obj"
' ----------------------------------------------------------------------------
declare function spool%(integer,string)
' integer = 0 - Status check
' 1 - Submit file
' 2 - Remove file
' 3 - Cancel all files
' 4 - hold printing
' 5 - resume printing
' string = if integer is 0,3,4,5 - null string
' = if integer is 1 - packet
' = if integer is 2 - asciiz file name
' ----------------------------------------------------------------------------
' Demonstration of STATUS
cls
a% = spool%(0," ")
select case a%
case = 0
print "PRINT not installed. Installing....."
'***
' In order for this to work, PRINT must be in a directory included in
' your path, or in the current directory.
'***
shell "PRINT /D:PRN > NUL:"
a% = 255
case = 1
print "PRINT not installed. NOT Ok to install."
case = 255
print "PRINT installed."
case else
print "Unknown Status."
end select
' ----------------------------------------------------------------------------
' Demonstration of SUBMIT
if a% = 255 then
print
input "Enter file to spool : ";filname$
if filname$ <> null$ then
' ***
' The following two lines build the packet as required by PRINT
' ***
filname$ = ucase$(filname$) + chr$(0)
packet$ = chr$(0) + mki$(strptr(filname$)) + mki$(strseg(filname$))
a% = spool%(1,packet$)
print "Result of Submit is: ";a%;" - ";
select case a%
case = 0
print "No Error."
case = 1
print "Function Invalid."
case = 2
print "File not found."
case = 3
print "Path not found."
case = 4
print "Too many open files."
case = 5
print "Access denied."
case = 8
print "Queue full."
case = 9
print "Spooler busy."
case = 12
print "Name too long."
case = 15
print "Drive invalid."
case else
print "Unknown error."
end select
end if
end if
' ----------------------------------------------------------------------------
' Demonstration of REMOVE
print
input "Enter a filename to remove from the queue {return = none}: ";xfile$
if xfile$ <> null$ then
'***
' Make sure the filename ends with a chr$(0) !
'***
xfile$ = ucase$(xfile$) + chr$(0)
a% = spool%(2,xfile$)
print "Result of Remove: ";a%;" - ";
select case a%
case = 0
print "No Error."
case = 1
print "Function Invalid."
case = 2
print "File not found."
case = 3
print "Path not found."
case = 4
print "Too many open files."
case = 5
print "Access denied."
case = 8
print "Queue full."
case = 9
print "Spooler busy."
case = 12
print "Name too long."
case = 15
print "Drive invalid."
case else
print "Unknown error."
end select
end if
' ----------------------------------------------------------------------------
' Demonstration of CANCEL
print
input "Do you want to cancel all the files in the spooler? {Y/N}: ";can$
if ucase$(can$) = "Y" then
a% = spool%(3," ")
print
print "Result of Cancel: ";a%
end if
' ----------------------------------------------------------------------------
' Demonstration of HOLD
print
print "Holding Print ...... Press any key to resume."
a% = spool%(4," ")
while inkey$ = null$ : wend
' ----------------------------------------------------------------------------
' Demonstration of RESUME
b% = spool%(5," ")
print
print "Result of Hold: ";a%
print "Result of Resume: ";b%
stop