Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to write a macro.

How to write a macro.

How to write a macro.

I need to create a letterhead macro.  I have never used PCL before and I would like to know if there are any examples out there.  I also would like to know how to automate it to be printed on all documents with either orientation.  Is this possible?

RE: How to write a macro.

Look at the PCL5 Technical Reference. There is an entire
chapter devoted to macros. Macros are NOT supported by
the vast majority of inkjet printers. Only PCL5 printers.

Start out simple. A complete macro.

<esc>&f10y0X<esc>*p500x500YTMy macro!<esc>&f1X<esc>&f10y10X

Dissecting the code above...

<esc>&f10y0X  The 10y declares macro #10 and the 0X part
declares the beginning of the macro definition"

The macro itself simple positions the cursor to 500x 500y
and prints the text My Macro!

<esc>&f1X declares the end of the macro definition.

Finally, <esc>&f10y10X  deems macro #10 to be permanent,
meaning that it won't be erased by a printer reset.

The macro first gets directed to the printer, but at that
point nothing prints.

In your actual application, you put the code <esc>&f10y4X
which enables macro #10 for automatic overlay. The macro
will be run on every page until the job is complete or
a disable automatic overlay command is ecnountered <esc>&f5X

You can get very  sophisticated with macros. They can be nested etc.

Jim Asman


RE: How to write a macro.

Thank you for your quick response.  As helpful and detailed as your response is I am still confused.  
I do not have the PCL5 Technical Reference Manual so I am kinda lost.  What do you mean by "your actual application"?  Do I create the macro in Word or Dos editor and how does it get to the printer?  I am using a network HP8000 and a Digital LNC02 printer.  Would I be right to assume that I need two separate macros?  I want printers to have the letterhead on all output without regards to what application is used.
Thank you in advance!  You help is greatly appreciated!

RE: How to write a macro.

Look at a previous thread about documentation where
there is a pointer to a PDF of the PCL5 Reference.

You need to distinguish between the creation of
the macro and its usage. A macro IS PCL code, so you
could simply type in PCL code using a DOS text editor.

A program like WORD does not create PCL code directly;
however, you could create the macro in the program by
printing to a file through a PCL driver. This though
would require the resulting PCL file to be edited to
convert it to a macro. There is a commercial program
called "forms electric" out of England to help with
this editing.

Your application the the program that will ultimately
use the macro. It is your or your application's
responsibility to get the macro into the printer before
it is called by the application. Simply printing the
macro file would make it resident in the printer.

For what you are after, you could put FLASH memory into
your HP printer and permanently download your macros
to the printer. Then your applications would only have
to call the macro and not worry about download.

I'm not familiar with your other printer and what
capabilities it has.

If you need some help with this, you can give me a
call at the office at (604)738-6112 during the day,
Pacific time.

Jim Asman

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close