MACROS

MACRO DEFINITION

     A macro is a collection of printer commands, control
     codes and/or data created by the user that is
     downloaded and stored in the printer's memory.  Once
     stored in the printer, a macro can be invoked by a
     single command.  Macros can eliminate the need to
     download the same information repeatedly, thus saving
     transmission time.  The number of macros that can be
     stored in the printer's memory is limited only by the
     amount of available memory (except in LJ II or earlier
     where 32 macros is the limit).  Practical uses of
     macros include forms, letterhead, logos and lengthy
     printer commands.

MACRO CREATION STEPS

     1.   Designate a unique identification number (Ec&f#Y).
          Any number from 0 to 32767 can be used and each
          macro ID number should be different. If a new
          macro is loaded that uses the same ID as a
          previously loaded macro, the previous macro will
          be deleted from user memory.

     2.   Send the start of the macro command (Ec&f0X).
          This indicates the following command and data are
          to be stored as a macro.

     3.   Send the escape sequences, control codes, HPGL/2
          commands and text to perform thedesired operation.

     4.   Send the Stop Macro command (Ec&f1X) to identify
          the end of the macro data.

     5.   Designate the macro as permanent (Ec&f10X) or
          temporary (Ec&f9X).  A macro stored as permanent
          will not be deleted by a printer reset.  A macro
          stored as temporary will be deleted with a printer
          reset.

MACRO INVOCATION

     To invoke a macro, send the Macro ID command with the
     ID number of the macro, then send the Macro Control
     command with a value field of  2, 3, or 4 (Ec&f2X),
     (Ec&f3X), (Ec&f4X).  This performs the macro in the
     specified mode:

                 2 = Execute
                 3 = Call
                 4 = Overlay

     EXECUTE     When a macro is executed, it begins
                 performing its commands using the current
                 modified print environment (see below for
                 explanation of modified print
                 environment).  1Changes made to feature
                 settings during macro execution are
                 recorded in the modified print
                 environment; these changes are retained
                 upon completion of the macro execution.

     CALL        When a macro is called, it begins
                 performing its commands using the current
                 modified print environment.  Changes made
                 to feature settings are recorded in the
                 modified print environment; however these
                 changes are not retained upon completion
                 of the macro call.  The modified print
                 environment that existed prior to the
                 macro call is restored.

     OVERLAY     When a macro is enabled for overlay, its
                 execution is the final operation each time
                 a page is printed.  Before the macro is
                 executed, the current modified print
                 environment is saved and replaced with the
                 overlay environment.  The overlay
                 environment is a combination of user
                 default and the current modified print
                 environments.  Changes made to feature
                 settings during the macro overlay are
                 recorded in the modified print
                 environment; however these changes are not
                 retained upon completion of the macro
                 overlay.  The modified print environment
                 that existed prior the macro overlay is
                 restored.

THE PRINT ENVIRONMENT


  FACTORY DEFAULT ENVIRONMENT

     A factory default is a feature setting programmed into
     the printer at the factory.  The group of all the
     printer's settings set to their factory setting is
     referred to as the Factory Default Environment.

  USER DEFAULT ENVIRONMENT

     A user default is a setting selected from the printer's
     control panel.  User default settings are stored in the
     User Default Environment and are retained even if the
     printer is turned off.

  MODIFIED PRINT ENVIRONMENT

     The current printer feature settings constitute the
     modified print environment.  Whenever a feature setting
     is altered using escape sequences, the new setting is
     recorded in the Modified Print Environment.  The
     Modified Print Environment is saved during a macro call
     or overlay and restored upon its completion.

DELETING MACROS

     There are several mechanisms provided by PCL macro
     control for explicit deletion of macros from user
     memory.  These include commands to delete all macros,
     all temporary macros, or an individual macro by
     reference to its macro ID number.  See the Macro
     Control Command.  Both temporary and permanent macros
     are deleted from memory whenever the printer's power is
     turned off.

MACRO CONTROL COMMAND

     The macro control command provides mechanisms for
     definition, invocation, and deletion of macros.

     Ec&f#X

     #  = 0                        Start macro definition
                                   (last ID specified)

     #  = 1                        Stop macro definition

     #  = 2                        Execute macro (last ID
                                   specified)

     #  = 3                        Call Macro (last ID
                                   specified)

     #  = 4                        Enable macro (last ID
                                   specified)

     #  = 5                        Disable automatic overlay
                                   (last ID specified)

     #  = 6                        Delete all macros

     #  = 7                        Delete all temporary
                                   macros

     #  = 8                        Delete macro (last ID
                                   specified)

     #  = 9                        Make macro temporary
                                   (last ID specified)

     #  = 10                       Make macro permanent
                                   (last ID specified)

MACRO NOTES

     *    A macro may call or execute another macro, which
          in turn may call or execute another macro, two
          levels of nesting are allowed.

     *    Other than call and execute, no macro control
          operations may occur within a macro.

     *    A printer reset (EcE or UEL) is not allowed in a
          macro.

     *    The macro enabled for automatic overlay is invoked
          on each page, until the macro is disabled or
          deleted, a reset occurs (through software or
          control panel), or the page length, page size or
          orientation is changed.

     *    HP-GL/2 commands are only supported in a macro in
          the LaserJet 4 family and above.

     *    PCL macro control commands are not allowed while
          in HP-GL/2 context.


            Copyright  Hewlett-Packard Co. 1993
   The information contained herein is subject to change
                      without notice.
   Hewlett-Packard shall not be liable for incidental or
  consequential damages in connection with the use of this
                         material.