Link to home
Start Free TrialLog in
Avatar of Chuckbuchan
Chuckbuchan

asked on

How do I manipulate print options using a WP macro?

WP = 9.0.0.883

I am trying to change print settings to use the Staple option during a merge.

When I record a macro enabling "Staple", it gives me something along the lines of:

Application (WordPerfect; "WordPerfect"; Default!; "EN")
PrinterSelectByName (PrinterName: "Generic 75/60BW-1 PCL imagistics")
PrintSettings (Action: Use!; SettingName: DriverSettings!)


After the macro runs, the staple box is not checked.

If anybody had an idea of what my problem may be, I would appreciate it.




Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

I would guess that WordPerfect cannot delve deeply enough into the printer settings to tick the appropriate box.  My suggestion would be to Add a printer using the Windows printer control panel, the same printer, same driver etc, with a name like Generic 75/60BW-1 PCL imagistics (staples).  Then enable the Staple option permanently in this driver.  Amend (or re-record) the Macro with the different printer.

This should work provided that the Staple option can be saved as the default for the printer.  If not, come back to us for further ideas.
Avatar of Chuckbuchan
Chuckbuchan

ASKER

Well, the thing is I'm trying to automate it. I need to turn the Staple setting on/off between different pages.

I have discovered that you can FILE > PRINT.. > Details > Print to File to get the settings for that certain printer.
It will then give you a PJL file (.prn) with the settings that get sent to the printer.

The option for staple on my printer is: @PJL SET BINDING = LEFT

To embed this, I could use either Format > Type Setting > Print Commands or by (I suspect) a PrintCommand() macro.

Anybody have any experience doing this?
I would say that

Format, Typesetting, Printer Command

is the correct way to do this within WordPerfect
I can't seem to find any examples. Entering the line itself doesn't seem to change the Staple option
What needs to be done is to send Printer Commands directly from a file (without using WordPerfect)- you will need a Hex Editor (Google for a free one - the one I use seems no longer available for download)  to be able to easily enter Escape and other Control characters.  The Printer Command Language you are using should have a well defined command sequence to send Staple commands to the printer.  Once this has been proven to work, amend the sequence to get rid of Reset, Paper Throw and other commands which WordPerfect will automatically insert into its' output stream.  Save this file and then give this file name to WordPerfect in the Typesetting command mentioned in my previous post.  You might like to start off by printing, not to the printer itself, but to a File on disk - this can be setup in the Windows PrinterControl Panel, then you can use the Hex Editor to see what actual commands WordPerfect is sending to the printer - the contents of your file should appear in this stream - best to send blank sheets to be printed so that there is less code to decipher.  It is an understatement to say this is not an easy thing to do.
>Printer Commands directly from a file

When you've compiled this, use Windows Notepad to print out the file.
I've basically done that much of it.
I have the commands that gets sent to the printer.
According to the Manufacturer "@PJL SET BINDING = LEFT" is the command that chages the staple.

Getting this command to work seperately with Typesetting > Print Commands is what I'm not able to do.
This should be how you are putting PJL commands into a PCL stream.  The 12345X command tells the printer you are moving into PJL mode.  

ESC%-12345X@PJL SET BINDING = LEFT
ESC%-12345X

(Where ESC is the Escape character)

The thing is that the command you are entering needs to be entered at the commencement of the job.  That's where you need to experiment as to whether this is possible.  Look at the file produced by WordPerfect in a hex text editor to see where your commands sit within the output stream.  If the printer has previously been reset and the print job started, the printer may ignore your commands.  Try using the STMSG command to see whether your commands are being acted upon.

@PJL STMSG="testing"
Because I understand the communication part, how I manipulate it is still somewhat fuzzy.

These are the commands I get when I retrieve the commands sent to my printer:



%-12345X@PJL
@PJL COMMENT "HEADER Generic 75/60BW-1 PCL"
@PJL COMMENT "Title : Corel Office Document ;"
@PJL COMMENT "Driver version : 01.51"
@PJL SET STRINGCODESET = UTF8
@PJL SET JOBNAME = "Corel Office Document"
@PJL SET USERNAME = "sjamell"
@PJL SET KMCOE = 72
@PJL SET RESOLUTION = 600
@PJL SET QTY = 1
@PJL SET PAPER = LETTER
@PJL SET ORIENTATION = PORTRAIT
@PJL SET MEDIASOURCE = AUTO
@PJL SET JOBOFFSET = OFF
@PJL SET OUTBIN = DEFAULT
@PJL SET FRONTCOVERMODE = NONE
@PJL SET BACKCOVERMODE = NONE
@PJL SET FRONTCOVERTRAY = TRAY1
@PJL SET BACKCOVERTRAY = TRAY1
@PJL SET MEDIATYPE = PAPER
@PJL SET OUTPUTMODE = FACEDOWN
@PJL SET NTO1 = OFF
@PJL SET TONERSAVE = OFF
@PJL SET SMOOTHING = OFF
@PJL SET PIFRONT = OFF
@PJL SET PIBACK = OFF
@PJL SET IMAGESHIFT = OFF
@PJL SET MEDIAWEIGHT = NORMAL
@PJL SET MEDIACOLOR = NONE
@PJL SET PCFAXMODE = OFF
@PJL SET PCFAXPAS = OFF
@PJL SET PCFAXDLY = OFF
@PJL SET HOLD = OFF
@PJL SET BINDING = LEFT
@PJL SET DUPLEX = OFF
@PJL SET LAYOUT = NORMAL
@PJL SET FINISH = NONE
@PJL SET PUNCH = OFF
@PJL SET FOLDING = OFF
@PJL SET FEEDDIRECTION = AUTO
@PJL SET INFONIN1 = NONE
@PJL SET CHAPTERMODE = OFF
@PJL SET TANDEM = OFF
@PJL SET PILEMODE = OFF
@PJL SET DRIVERJOBID = "001676060FF50C05091208029F"
@PJL SET CUSTOMPAPER0 = "M,2100,2100"
@PJL SET CUSTOMPAPER1 = "M,2100,2100"
@PJL SET CUSTOMPAPER2 = "M,2100,2100"
@PJL SET CUSTOMPAPER3 = "M,2100,2100"
@PJL SET CUSTOMPAPER4 = "M,2100,2100"
@PJL SET CUSTOMPAPER5 = "M,2100,2100"
@PJL SET CUSTOMPAPER6 = "M,2100,2100"
@PJL SET CUSTOMPAPER7 = "M,2100,2100"
@PJL SET CUSTOMPAPER8 = "M,2100,2100"
@PJL SET CUSTOMPAPER9 = "M,2100,2100"
@PJL ENTER LANGUAGE = PCLXL
) HP-PCL XL;2;1;Comment Copyright(C) 2005 SOFTWARE IMAGING K.K. All rights reserved., JWING PCL-XL Core Library=1.44.05b, JWING Job Finisher Library=1.15.x5


Now, at the very beginning is some code that I couldn't copy(it shows up as an unreadable character), but when I highlight it, it displays " ESC(^[=27=0x1b). there is also a formula of some sort at the very end of it.




The staple command, according to the printer manufacturer is the  "SET BINDING" line.
>according to the printer manufacturer

It sounds that there is some uncertainty here.  I would have thought that there would be a multitude of options associated with Binding, if Binding is set on, of which Staple would be one or more.  For instance: where do you want the staple to go (is the job portrait or landscape)?  How many sheets are to accumulate before a staple is driven?  

Incidentally another method of solving this problem: is there Postscript support on this printer?  If there is then you could try using that instead.
Ok, I should'nt have went off what the manufacturer told me, because they were wrong.


@PJL SET PUNCH = OFF is actually the staple option.
When there is one staple, it should = LEFT1POINT
When there is two staples, it should = ANY2POINT



I did have problems getting wordperfect to set the printer settings..

When I enter them from TypeSetting > Printer Commands, would the line be @PJL SET PUNCH = LEFT1POINT
or would it have the header to start it off with? ex., %-12345X@PJL @PJL SET PUNCH = LEFT1POINT
and then perhaps the closing? @PJL ENTER LANGUAGE = PCLXL


Also another thing I need addressed, I'm hoping I could insert these commands using WPscript  PrinterCommand()
Does this get entered exactly as it within the file, or like above in this same comment?


Let me sum up what I'm doing.
100+ files will be merged every day. The first 3 pages are to be separated, the next 6 are stapled, the following 6 are stapled, and then the next 6 will be stapled again. This restarts on the next file (3 separated, 6 stapled, etc, etc)
So I will literally be sending multiple jobs to the printer to refresh the print commands as to make sure those pages aren't stapled.

I greatly appreciate your help. For now I'm leaving this thread open in case anybody else has any suggestions to throw in since I'm on a very short schedule.
that should be @PJL SET FINISH = NONE, not PUNCH. I copied the wrong one.
It would definitely need the UEL to start it off (this is the ESC %-12345X command), and similarly at the end of the commands - this is because the printer is natively printing PCL, it understands PJL commands only when you give it that preamble code (they call it the UEL - Universal Exit/Escape Language).  To tell it to go back into PCL mode at the end you need the UEL again.  The ENTER LANGUAGE command is not necessary.
I opened up the .prn with textpad.

Right before the "%-12345X@PJL" (and at the end of the file) is a character that when moused over, displays ESC(^[=27=0x1b).

I know this is the ESC command you're referring to, it's just weird how it displays it within textpad.

This whole line, does this typically change with different print jobs? I haven't noticed that is has.
And when I enter the command into WP, would I have to enter the whole "ESC(^[=27=0x1b)" or just ESC, and then %-12345X + the @PJL command?
Anytime I attempt to print with a command embedded, my print job does nothing.
ASKER CERTIFIED SOLUTION
Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting. I can convert decimal into binary, but I've never had experience in hexadecimal.

You have provided a tremendous amount of help. I do have one more question, though.
I was discussing this with a friend last night about entering commands into Typesetting > Printer Commands, and he said it's a possibility that to do it correctly, the printer would have to have EVERY command sent to it. So essentially that list I pasted earlier in this thread would have to go in..

I was somewhat under the impression Typesetting > Printer Commands would allow me to enter a single command which would change only that one option (in this case, the stapling).
Yes you can enter just one command in there, the other commands would simply stick to the same settings as you see them on that list.

---
To convert from Binary to Hex is in fact easier than converting Decimal into Binary.  Just pick up each group of 4 binary bits and see which of these patterns they belong to: the Hex equivalent is shown next to the binary pattern:-

0000 is 0
0001 is 1
0010 is 2
0011 is 3
0100 is 4
0101 is 5
0110 is 6
0111 is 7
1000 is 8
1001 is 9
1010 is A
1011 is B
1100 is C
1101 is D
1110 is E
1111 is F

ESC is 1B.
1B in binary is 0001 1011

The reason everyone uses Hex is that it is effectively a shorthand for Binary.
Thanks for the editor tip. I've been using ultraedit, but hey, free is good too.

Any command I enter into >Printer Commands, or even when I use the Printer Command Filename (I used the default .prn and changed a setting to see if it would stick) however, everything is concatenated to the default printer commands (meaning when I print to file again, I get TWO sets of printer commands with the second one completely ignored).

The same thing happens when I enter a single command from Typesetting > Printer Command... it gets added to the end of the file and seems to completely ignore it.
Is there a way to enter Hex into the box for Typesetting? I don't understand what I'm doing wrong. This stuff is just over my head.
Produce the Printer Commands in a file.  Rename that file and use that filename in the Printer Command Filename.  

I take it you are sending printer output to a file to see what's happening, prior to adjusting the Control Panel Printer to print out to the Printer rather than to a file on disk.
>This stuff is just over my head.

This is about as advanced as anything that can be done in WP.  It is very difficult to get to grips with because you are pushing the program in ways only vaguely envisaged by the designers.  Upgrading the program to a newer version might help, but no guarantees.
>>I take it you are sending printer output to a file to see what's happening, prior to adjusting the Control Panel Printer to print out to the Printer rather than to a file on disk.


That is correct.
I've actually printed out two Printer Command files. One with the staple option on, and one with it off.

*Inserted Default Printer Command*
PrintRangeFrom (Page: vSepBeg)
PrintRangeTo (Page: vSepEnd)
PrintAction (Action:AdvancedMultiplePages!)
Print()

*Inserted Staple on Command*
PrintRangeFrom (Page: vGroupBeg)
PrintRangeTo (Page: vGroupEnd)
PrintAction (Action:AdvancedMultiplePages!)
Print()

the Variables in the (Page:) macro are a range I have set to control what gets stapled and what doesn't.


One possibility that may be messing this up is that I can't print out a total blank doc. It only allows me to print if I have a character of some sort within the page (a space, any ascii character, font code, etc)

I then edit out everything but the code itself, with both header and closing print commands still inside.
Everything gets concantenated, as if its just throwing a lump of unreadable code to the bottom of it.

Maybe I should explore the PrintCommand() macro a little more.

Thank you for your advice and patience.
My printer is an Imagistics IM7520, if you're interested.
Something I just discovered. There is a perfectscript function called NTOC, which will convert a number to its "character equivilent"
Thank you, moorhouselondon