Print Code - Replace With Script Follow

0
Avatar
Legacy Poster

Hi experts,

 

I want to replace something in the print code.

 

So I added a script in Visual Basic Scripting:

 

codepage = PCM.CodePage
 
Do Until PCM.FileAtEOF
    variableLine = PCM.ReadLine(codepage)
    PCM.WriteLine variableLine, codepage
Loop 

 

 

Very easy - just looping throug the code and write it again, nothing replacing, just a 1:1 copy (I thought).

 

Now I have added an image to the label (that's the only element), the image is embedded.

 

When I print now, the print code is different (I print to file)! Something must go wrong or I miss something im my code?

When I send the "original" file to the printer, everything's fine. 

When I send the "manipulated" one, printer says that something's wrong with the embedded image.

 

I compared both files - I can't see the difference exactly ('cause it's only something in HEX) but I can see there's a difference...

 

Do you have any ideas what I'm doing wrong?

 

Thanks

Michael 

3 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

The PCM script you have there is only going to work on ASCII characters.  Trying to read in binary data and then writing back in ASCII is probably what's going wrong.  Why would you need to read/write graphic data any how?  Depending on whether the printer supports it, choose a readable encoding for graphic data in the printer driver.  If you tell me the make/model of the printer, I can tell you if it's supported and how to do it.

0
Avatar
Legacy Poster
Comment actions Permalink

Hi Ian,

 

what I want to do is to replace all "#999#" in the print code with "[SER:001]".

Now I tried the replace function - everything is fine now.

 

Just for information - I use a CAB printer, use the commander, make text files to print the label.

 

Thanks for the update...maybe you have a solution using the vb code.

If not it's also no problem, because it's working now

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

I suppose you would need to use the ReadBytes() and WriteBytes() functions to maintain compatibility with the binary data.  However, this will increase the complexity of your script, so I'd keep with the replace function if it's working well for you.  Unfortunately there is only the PCX binary graphics encoding for cab printers available to us, so that option will not work in this case.  Sorry, I don't have a read/write by bytes PCM script example to give you.

Please sign in to leave a comment.