I wrote the command file herein to handle a particular problem. If you can use it, 
fine, otherwise, X it.

  -- ----------------------------------------------------------------------
  -- ShopPrtr.rmd
  -- Albert Berry 01/08/2003
  -- Finds and sets up HP 5100 Printer. HP 5100 printers have 11x17
  -- capability. The only catch is that all users must have 5100 in the
  -- printer name when they set the driver up.
  -- ----------------------------------------------------------------------
  SET VAR vPaper TEXT
  SET VAR vPrinterList TEXT
  SET VAR vItemNo INTEGER
  SET VAR vItemCount INTEGER
  SET VAR vPrinter TEXT = NULL
  -- ----------------------------------------------------------------------
  -- Set the default paper size if it was not passed in.
  -- ----------------------------------------------------------------------
  SET VAR vPaper = .%1
  IF vPaper IS NULL THEN
      SET VAR vPaper = "11x17"
  ENDIF
  -- ----------------------------------------------------------------------
  -- Check to see if the current printer is already the 5100. If it is, we
  -- need only set the large paper.
  -- ----------------------------------------------------------------------
  SET VAR vPrinter = (CVAL("CurrentPrinter"))
  IF vPrinter LIKE "*5100*" THEN
      PRNSETUP "PAPER SIZE" .vPaper
      GOTO stop
    ELSE
      -- Used to determine if, in fact such a printer exists
      SET VAR vPrinter = NULL
  ENDIF
  -- ----------------------------------------------------------------------
  -- If not, get the list of printers and find it in the list. If it is not
  -- in the printers set up on this computer (or has been incorrectly
  -- named) use the Windows default printer and paper size.
  -- ----------------------------------------------------------------------
  SET VAR vPrinterList TEXT = (CVAL("PRINTERS"))
  IF vPrinterList IS NULL OR vPrinterList NOT LIKE "*5100*" THEN
      PAUSE FOR 5 USING "NO 5100 SERIES PRINTER SET UP - EXITING"
      GOTO Stop
  ENDIF
  -- ----------------------------------------------------------------------
  -- Find the printer name that contains the string "5100". Stop looking
  -- when we run out of items. If no matching printer is found, use the
  -- Windows default printer and paper size.
  -- ----------------------------------------------------------------------
  SET VAR vItemCount = (ITEMCNT(.vPrinterList))
  SET VAR vItemNo = 0
  WHILE vItemNo < .vItemCount THEN
    SET VAR vItemNo = (.vItemNo + 1)
    SET VAR vPrinter = (SSUB(.vPrinterList,.vItemNo))
    IF vPrinter LIKE "*5100*" THEN
        BREAK
    ENDIF
  ENDWHILE
  IF vPrinter IS NOT NULL THEN
      PRNSETUP "PRINTER NAME" .vPrinter
      PRNSETUP "PAPER SIZE" .vPaper
  ENDIF
LABEL stop
  RETURN


-- 
Albert Berry
Full Time Consultant to
PSD Solutions
350 West Hubbard, Suite 210
Chicago, IL 60610
312-828-9253 Ext. 32


__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

Reply via email to