Anyone have good recommendations on how to create ...
# suitescript
b
Anyone have good recommendations on how to create a ZPL file within SuiteScript?
a
You can just have a function that returns a string of your zpl based off your parameters. I have done it before. Pretty straghtforward. Do you have any unique requirements?
b
Hey thanks for your input @Azi. As I understand SuiteScript can only create certain file types.... TXT, CSV, PDF, etc
Is it possible to have a SuiteScript use file.create to create a ZPL file?
a
So I don't know exactly how you plan on using that, but you can just create a text file with an extension of
.zpl
b
ahhh ok then!
We need to create the ZPL file, then save it in the FILE CABINET. For use later.
But, of course, the ZPL file must be able to be used with the Zebra printer.
So it is possible with file.create to set the file extension to ".ZPL" ?
a
I don't thinks so
b
Oh I thought that's what you were saying earlier.
"just create a text file with an extension of
.zpl"
So you've never used file.create to create a ZPL file before?
a
Sorry. Yes. I misunderstood your last question.
So it is possible with file.create to set the file extension to ".ZPL" ?
Yes. Should should be able to create a plain text file and just name it myfile.zpl
b
Ok ok then good news there.
Let me give it a try then!
a
I could be wrong
a
ZPL is just a text file, nothing else.
b
Hey @alien4u thx for the input.
I suppose for an actual Zebra printer to actually print the file though. It must have a .ZPL extension.
I don't think Zebra printers will take .TXT files.
a
@alien4u Correct, but will file.create automatically add a file extension?
b
So trying to determine how to create that .ZPL file fully and wholly within Suitescript.
a
You should be able to create a file with any extension you want...
a
That's what I thought
b
Ahhh... I was under the understanding that file.create can only create files with certain extensions.... TXT, CSV, PDF etc
Maybe there is a way to have file.create create a .ZPL file then??
a
@Brian Brown File create defines the file type but you can set whatever name you want, including the extension.
☝🏿 1
b
Ahhh ok ok then! We're not limited to a certain set of defined file extensions then?
good news there... and that's mostly what I was trying to understand here
Thx guys, I think that makes sense.
Next, to find a library function to create ZPL text content! lol 😄
a
@Brian Brown No library that I'm aware of, you need to create the ZPL content yourself, I used this back in the day when I was creating stuff for Zebra Printers
b
Thank you @alien4u. Great tool here!
Thanks guys, I owe you one!
a
With template literals available in 2.1 its very easy to do yourself once you generate the what you want the label to look like in labelary