Progress
Results User’s Guide
for UNIX


Designing Your Own Print Menu

You can design and include your own print menu to replace the print menu in Results. To include your own print menu, in the Administration module you must delete all print devices except one and give it the type prog. Then set the device name to the name of the user print menu. When users select the Run option, your printer menu program runs and the user sees the default scrolling list of printer devices.

Results generates the procedure (usually _qbf.p), then does the following:

RUN VALUE(device-name) (INPUT program-to-run). 

A user program might be something simple, like:

DEFINE INPUT PARAMETER program-to-run AS CHARACTER NO-UNDO.
DEFINE VARIABLE elapsed-time AS INTEGER NO-UNDO.
elapsed-time = ETIME(TRUE).
OUTPUT TO PRINTER NO-ECHO.
RUN VALUE(program-to-run).
OUTPUT CLOSE.
HIDE MESSAGE NO-PAUSE.
MESSAGE "Actual elapsed time =" ETIME / 1000 "seconds".
RETURN. 

Or it could be more complicated, like the u-print.p program that is supplied with Results.

For example, your printer menu program might look like this:

DEFINE INPUT PARAMETER program-to-run AS CHARACTER NO-UNDO.
DEFINE SHARED VARIABLE qbf-module     AS CHARACTER NO-UNDO.
DEFINE        VARIABLE thru-name      AS CHARACTER NO-UNDO.
DEFINE        VARIABLE menu  AS CHARACTER EXTENT 7 NO-UNDO.

/* If called from Labels module, */
/* then go straight to labels spooler.  */
IF qbf-module = "l" THEN DO:
  OUTPUT THROUGH "lpr -Plabel2" NO-ECHO PAGE-SIZE 0.
  RUN VALUE(program-to-run).
  OUTPUT CLOSE.
  RETURN.
END.

/* Select which printer from the menu */
PAUSE 0.
DISPLAY
  "1. Letter Quality Printer"    @ menu[1] SKIP
  "2. Laser Printer - portrait"  @ menu[2] SKIP
  "3. Laser Printer - landscape" @ menu[3] SKIP
  "4. Color Laser Printer"       @ menu[4] SKIP
  "5. Dot-Matrix Printer"        @ menu[5] SKIP
  "6. Line Printer"              @ menu[6] SKIP
  "7. Local Draft Printer"       @ menu[7] SKIP
  WITH FRAME print-menu NO-LABELS ROW 4 CENTERED.

DO ON ENDKEY UNDO,LEAVE:
  CHOOSE FIELD menu AUTO-RETURN WITH FRAME print-menu.
  HIDE FRAME print-menu.

  /* Now set the spooler name.  For this installation,  */
  /* each user has a local printer named "pr_" plus the */
  /* first three letters of their userid.               */
  thru-name = ENTRY(FRAME-INDEX,
    "lq,laser,laser,color,draft,draft,pr_" + SUBSTRING(USERID,1,3)).

  /* Start the output.  If the user selected the laser */
  /* printer, select portrait or landscape mode.       */
  OUTPUT THROUGH VALUE("lpr -P" + thru-name) NO-ECHO.
  IF FRAME-INDEX = 2 THEN PUT CONTROL "esc-to-go-portrait".
  IF FRAME-INDEX = 3 THEN PUT CONTROL "esc-to-go-landscape".
  RUN VALUE(program-to-run).
  OUTPUT CLOSE.

END.
HIDE FRAME print-menu.
RETURN. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095