Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write a macro. 2

Status
Not open for further replies.

tpercy

Programmer
Oct 3, 2002
19
US
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?
 
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&quot;

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

jim@spctra.wimsey.com
 
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 &quot;your actual application&quot;? 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!
 
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 &quot;forms electric&quot; 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
jim@spctra.wimsey.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top