How do I obtain ZPL command return value from code - vb6

How do I get return value from a printer if I called this command in vb6, on Zebra Setup Utilities it will display information regarding about the printer. I try running this command and print nothing
Printer.Print "${^XA^HH^XZ}$"
Printer.EndDoc

Related

How to Get some text from the variable in ZPL Command

i have created a simple zpl program. My program Using call a variable, connect with database and uploading in web, this program example:
^XA
^JMA
^PR2
^~SD20
^BY3
^LH20,10
^FO155,152^BY2^BCN,40,N,N,N^FD$USIM$^FS
^A0N,30,30^FO155,197^CI0^FH_^FDNo.SimCard:$USIM$^FS
^PQ1,0,1,Y
^XZ
And result after printing is like
*"Barcode"*
No.Simcard:123456789
My case is how to take just a few numbers in the variable at $USIM$, like a function on the LET that can take several digits from a variable, for example
LET A$="Zebra Quality Printers"
LET B$=A$(1:13)
PRINT B$
Zebra Quality
I want to be able to in my program is only take last 3 digits at $USIM$
*"BARCODE"*
No.Simcard:789
I read the Zebra documentation and it only can in ZBL command, how to convert or make it work in ZPL command ?
Please Help me,
Thank you in advance

OpenEdge 10.2A - INPUT THROUGH set does not work after Windows Update 1703 on Windows 10

We were using below code to get the name of the computer.
def new shared var cHost as char format "x(40)" no-undo.
INPUT THROUGH hostname NO-ECHO.
SET cHost.
INPUT CLOSE.
DISPLAY chost.
After we have updated our computers (Windows 10 - 1703), it no longer works. It seems SET cHost is the part where it fails. I have tried IMPORT UNFORMATTED cHost but it does not work.
PS: I can get computer name using OS-GETENV("COMPUTERNAME") but I have to do it using INPUT THROUGH statement.
Edit: It seems that it is not only a problem with 10.2A but a more general one. Also it is not just related to hostname but all console applications and ms-dos commands. Now I will try to replace INPUT THROUGH statement with another Progress command if there is any, or try to communicate with existing console applications with some other method.
The first thing I would do is to verify that the 'hostname' command is still working properly from a command window.
Assuming that it is I would code your snippet something like this:
INPUT THROUGH VALUE( "hostname" ).
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
DISPLAY cHOST format "x(60)".
Which might reveal a more useful error message than "it no longer works".
Since COMPUTERNAME meets your needs but you must use INPUT THROUGH for some very mysterious reason you might also try:
INPUT THROUGH VALUE( "echo %COMPUTERNAME%" ).
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
DISPLAY cHOST format "x(60)".
It seems the problem may not be limited to Openedge version 10. I am running a windows 10 winver 1703 device for development, using Progress/Openedge 8.3 and I am no longer able to execute this.
def var a as char format "x(70)".
input through "echo %cd%" no-echo.
import unformatted a.
input close.
message a. pause.
This runs on a windows server 2012 R2, using progress/openedge 8.3.
Where is no longer works, it just exits from within the program when it hits the import command.
Since it seems as a bug, until someone comes up with a better solution, this is how I will change my codes:
DEF VAR cHost AS CHAR FORMAT "x(40)" NO-UNDO.
OS-CREATE-DIR VALUE("c:\temp").
OS-COMMAND SILENT VALUE("hostname >c:\temp\hostname.txt").
INPUT FROM VALUE("c:\temp\hostname.txt").
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
MESSAGE cHost.
This code can be used for other ms-dos commands and console applications as well.
DEF VAR cHost AS CHAR FORMAT "x(40)" NO-UNDO.
OS-CREATE-DIR VALUE("c:\temp").
OS-COMMAND SILENT VALUE("ECHO %cd% >c:\temp\result.txt").
INPUT FROM VALUE("c:\temp\result.txt").
IMPORT UNFORMATTED cHost.
INPUT CLOSE.
MESSAGE cHost.
Thanks for your help.

Intermect PB42 print image

i am trying to print receipt from windows mobile 5 to intermec PB42 (thermal printer) , i had tried the ESC/P commands also easy print commands .
i tried also ESC/POS from here but still cannot print .
and i found PRN file that contains image and it worked but i cannot generate this format and i do not know what is this format (file link https://www.dropbox.com/s/0wonnt68nltxd4j/PrintPad_Receipt_Demo.prn?dl=0).
Intermec PB series printers used the Intermec Printing Language, IPL. See http://apps.intermec.com/downloads/eps_man/934-013.pdf for details.

How to create a Printer object in VB

I am facing an issue in VB 6 while creating a Printer Object.
Basically, I need to create a printer object so that I can set the correct tray on which printing needs to be performed.
I have the Printer Name with me.
All the code that I am able to find online involves looping through all the available printers and finding a match with our printer name.
Is there a way I can create the Printer object prn directly from the Printer name.
Any help would be appreciated.
You can't. The VB6 Printers collection is accessed only by index, not by name. See Visual Studio 6 Printer Object, Printers Collection.
So you have to search the collection for the printer you want. For instance:
Private Function FindPrinter(PrinterName As String) As Printer
Dim i As Integer
For i = 0 To Printers.Count - 1
If Printers(i).DeviceName = PrinterName Then
Set FindPrinter = Printers(i)
Exit For
End If
Next i
Exit Function
End Function
The above doesn't handle the situation where the printer you're looking for isn't in the collection. You'll want to add logic to cover that condition - what you'll want to do is specific to your particular tasks and requirements. This example is also a case-sensitive name search, so keep that in mind, too.

Gets stops processing script if it encounters a apostrophe

I'm futzing with a lesson over on Codecademy, pretty basic but the lesson prompts the user for a string and then prompts them for words to hide from the string. I've already finished with the lesson but I wanted to try messing with it outside of the lesson.
What I'm finding is the following script will run to completion in the lesson's scripting and interpreter area but if I try to run the same script over at say labs.codecademy.com or repl.it
I'll get prompted for the first question and if I enter a string containing an apostrophe it won't go on to the next prompt. I'm not getting an error, but eventually I'll get a "This program is taking too long to finish" pop up.
Here's the script:
puts "Tell me something."
text = gets.chomp
puts "What would you like me to forget?"
redact = gets.chomp
words = text.split(" ")
words.each { |text|
if redact.include? text
print "REDACTED "
else
print text + " "
end
}
So for example if you were to enter I really like blueberry pie that passes, but if you were to enter They've told me I should try the blueberry pie the program gets hung up.
I'm a complete novice when it comes to Ruby, but is there a way to have gets process that sort of punctuation? Or is that not the right way to go about it? Or is it just the environment I'm trying to run this program in?
IO.gets is a system-level call: http://apidock.com/ruby/IO/gets
it well read from STDIN (standard input) which is the text that you type in a terminal window: http://en.wikipedia.org/wiki/Standard_streams
browsers per-se don't have this and it might depend on the implementation of the web-based console about how they handle calls like that. usually, there are known limitations (like this one).
as #BroiStatse pointed out, it might as well be a bug in in their browser-based implementation.

Resources