Local printer port using system variable as a counter

1

Anyone know of a way to set a local printer port to use a system variable or some form of method to create a counter or unique identifier.

I currently have a printer setup where I have a new port as \\someserver\share\printjob.pcl

This then creates a PCL 5 file for the print job but I am wondering if there is a way to set a system variable to be acknowledged, like %username% so it generates something unique if multiple users are printing jobs.

Ultimately, I am converting the PCL file to a PDF via a custom VBScript service. unfortunately there is room for it stepping on itself which I want to try and avoid.

ssaviers

Posted 2014-05-01T17:39:40.967

Reputation: 366

also what is up with this, lol http://nerdanswer.com/answer.php?q=549344

– ssaviers – 2014-05-01T18:37:51.353

Answers

1

You can use separation pages for this. Windows comes with a number of pre-defined separation pages but you need to enable separation pages from Printer Properties > Advanced tab > Separation Pages. Select the file you want (e.g. PCL.SEP) from C:\Windows\System32

You can modify the selected file. The Username (@N) is normally included in the default file, but you can add or put it somewhere else. You can also include the contents of a specified text file (@Fpathname). That file can contain the text you want. Alternatively, depending on which is easier for you, you can just add the text to the sep file (@T). If you really need a counter, then you may need to use some script to create the text file with the data.

The required syntax is available from Microsoft Support.

hdhondt

Posted 2014-05-01T17:39:40.967

Reputation: 3 244

man, the timing on this couldn't be better... I just was on the server pondering some other re-design means because I had issues this afternoon with the script hanging up on itself. Going to give this a whirl. – ssaviers – 2014-05-08T07:35:56.493

unfortunately after reading more and understanding the usage on the KB page this wont particularly resolve the issue I am facing. Since the port path is hard coded each forthcoming job following can over write the previous if the service hasn't started picking up the file. – ssaviers – 2014-05-08T15:37:47.157

@ssaviers Not sure I understand your last comment. Are you saying that the printjob.pcl file will be overwritten by the next job? Of course it will - unless you do something with it (rename, move, etc) - but that does not affect the separation page, as that is part of the file. – hdhondt – 2014-05-09T11:55:26.283

yes, unfortunately when you print from this application I am dealing with it bursts up to 10 individual print jobs to the printer back to back, my script even running every half a second cant grab and lock the file fast enough. I can not set the vbscript to not have a sleep state or it throws wscript out of control. I am currently using a utility I found from PageTech that installs a PortMonitor driver which does facilitate an auto increment as it spools the files. So far its working, just not sure on the licensing yet, had hoped I could figure something out that didn't require 3rd tool. – ssaviers – 2014-05-09T17:19:33.403

Sounds as if that may be your only option, if the jobs come that fast. If you're using PageTech to create the PDF, their s/w can also insert the data you want. See http://www.thefreelibrary.com/PageTech+Announces+Release+of+Its+New+PCLMagic+Printer+Drivers.-a0273880779

– hdhondt – 2014-05-11T01:41:16.923