home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------- Start REXX Source ----------------------------*/
-
- /* MPrint.rexx
-
- Magus! Print Spooler
- v1.00 Associated files: Magus!.rexx
- Magus!Cntl.rexx
- by Magus!Util.rexx
- Dan Schenck MPrintIt.rexx
- Tulsa, OK
-
- GEnie: D.SCHENCK
- (918) 492-0523
- */
-
- /* Requires rexxarplib.library v2.1 */
-
- signal on BREAK_C
- true = 1
- false = 0
- cdir = pragma('D')
-
- parse arg name .
-
- if ~showlist("P","MAGUSPORT") then
- do
- address "REXX" "rexx:MAGUS!.rexx"
- do while(~showlist("P","MAGUSPORT"))
- call delay(150)
- end
- end
-
- call parse_dir
- do forever
- do while(name = "df0:||||")
- name = getfile(200,200,cdir,,'Select File to Print or CANCEL to EXIT')
- if name = "" then call end_all()
- call parse_dir
- end
- if index(cdir,":") = 0 then file2show = pragma('D') || cdir || "/" || name
- else if right(cdir,1) ~= ":" then file2show = cdir || "/" || name
- else file2show = cdir || name
- prt_options = Getenv('prt_options_raw')
- do while (Getenv('prnt_spooler') = 'GETTINGCLIP')
- call delay(25)
- end
- rtn = Setenv('prnt_spooler','GETTINGCLIP')
- rtn = Setenv('next_file2print',file2show||'^'||prt_options)
- rtn = Setenv('prnt_spooler','NA')
- address "MAGUSPORT" "PRINT "
- name = "df0:||||"
- end
-
- /* parse_dir Procedure */
- /* */
- /* Separate the directory portion of the file name if there is any from */
- /* the file name itself. "cdir" will contain the new directory or be left */
- /* untouched if there is no directory. "name" will be modified to only */
- /* contain the file name itself or "df0:||||" if there is no file name. */
-
- parse_dir: procedure expose cdir name
- if length(name) = 0 then
- do /* No name or directory */
- name = "df0:||||"
- return
- end
- if ~exists(name) then
- do /* Bad directory/file name */
- name = "df0:||||"
- return
- end
- i_colon = lastpos(":",name)
- i_slash = lastpos("/",name)
- if left(statef(name),1) = "F" then
- do /* This a file, not just a directory */
- if i_slash > 0 then
- do /* At least one subdirectory has been given */
- cdir = substr(name,1,i_slash-1)
- name = substr(name,i_slash+1)
- return
- end
- if i_colon > 0 then
- do /* A main directory has been given */
- cdir = substr(name,1,i_colon)
- name = substr(name,i_colon+1)
- return
- end
- return
- end
- if i_slash > 0 then
- do /* A subdirectory with no file has been given */
- cdir = name
- name = "df0:||||"
- return
- end
- /* A main directory or subdirectory only has been given */
- if i_colon = 0 then cdir = cdir || name
- else cdir = name
- name = "df0:||||"
- return
-
- BREAK_C:
- call end_all()
- end_all:
- exit
-
- /*----------------------------- End REXX Source -----------------------------*/
-