1. Erick Bergsma
  2. PowerBuilder
  3. Friday, 6 December 2019 16:57 PM UTC

Hello all... Seasons greeting...

 

My question today has to do with the RUN command in PowerBuilder.

I am re-writing some logic to print labels.  We are moving away from an ActiveX and Intermec label printer, to using ZPL with Zebra Printers.

In the new Windows 10/PB 2017 environment we are in, the OCX is s-l-o-w.  40 seconds between printing labels, where in the Windows 7/PB 9 environment, it's about 1 or 2 seconds between labels.

I have the proper ZPL code structure, and using Notepad, or Word, or Notepad++ directly, the labels print just fine.

...but when I transfer the call to inside a RUN command, it won't print.

For example, I create a file, and in a Windows DOS prompt, I issue this...

      notepad /p "lubelabelzpl.txt"

… the formatted label prints just fine.

In PB, I issue Run('notepad /p "lubelabelzpl.txt"') , and it won't print.

same issue, if I try to use the "echo" command...

in the DOS window, I can issue this...

echo  "^XA^ILR:SAMPLE.GRF^FS^FO10,20^ASN,36,15^FDLUBE 37052-1          Pill Bottle^FS^FO700,20^ASN,36,15^FD10195631^FS^FO10,80^AFN,36,02^FDLUBRICATION SYS  - COIL CONVEYOR^FS^FO10,140^ASN,36,15^FD1434859: #1 CPM EXIT COIL CONVEYOR GB (W/C)^FS^FO10,200^AFN,36,02^FDKENL PROC CMC1 CRS1 EXIT CONV LUBE^FS^FO10,260^ASN,36,15^FD201-220 Gear Oil Analysis^FS^FO10,320^AFN,36,02^FDCompon Hrs:____ Lube Hrs:____ 07/22/2019^FS^FO10,380^ASN,36,01^FDSamp B4 Chg[ ] 1st Samp Aft Chg[ ] Routine Samp[ ]^FS^FO700,80^BY4^B7B,15,0^FD12345678^FS^XZ" >\\HAPS01\ITSOLZEB

… and it prints just fine

I issue it in PBC via the RUN command...and it doesn't print, doesn't even go to the queue.

Any ideas?

 

 

 

 

Accepted Answer
Brad Mettee Accepted Answer Pending Moderation
  1. Saturday, 7 December 2019 15:09 PM UTC
  2. PowerBuilder
  3. # Permalink

See my reply here: https://community.appeon.com/index.php/qna/q-a/pb9-printsend

It's pretty easy to write raw data to the printer from directly in PB, once you know how.

Comment
  1. Erick Bergsma
  2. Monday, 9 December 2019 12:48 PM UTC
Worked perfectly.

Might be obsolete...but it still works for backward compatability….so I'll use it :-)
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 7 December 2019 23:02 PM UTC
  2. PowerBuilder
  3. # 1

The return code from the Run command has nothing to do with whether the program you are running worked or not.

You should try my RunAndWait example which can return the program return code back to PowerBuilder.

http://www.topwizprogramming.com/freecode_runandwait.html

 

Comment
There are no comments made yet.
Christopher Altvater Accepted Answer Pending Moderation
  1. Friday, 6 December 2019 17:36 PM UTC
  2. PowerBuilder
  3. # 2

Hello Erick,

You could try the LPR protocol. When I had a Zebra printer many years ago, I used something like below to print labels from the ZPL script.

ls_cmd = 'lpr -S ' + sle_printer_addr.text + ' -P ' + sle_printer_port.text + ' "' + sle_file.text + '"'
Run(ls_cmd, Minimized!)

I hope this helps.

Chris

Comment
  1. Erick Bergsma
  2. Friday, 6 December 2019 17:52 PM UTC
Thanks Chris!

I found a lpr.exe here...



C:\Windows\WinSxS\amd64_microsoft-windows-p..ting-lprportmonitor_31bf3856ad364e35_10.0.17134.1_none_99842dd8a6f8feef



However when I try to run it, it says it's not compatible with my version of Windows.



I tried different Compatibility settings, but still won't run.
  1. Helpful
  1. Christopher Altvater
  2. Friday, 6 December 2019 18:14 PM UTC
That doesn't surprise me. I recall some issues getting this protocol to work on Windows 7. I was able to print ZPL scripts using a Windows generic text driver. Also, there is a Zebra printer driver from Seagull Scientific that worked well when printing DWs.
  1. Helpful
There are no comments made yet.
Erick Bergsma Accepted Answer Pending Moderation
  1. Friday, 6 December 2019 17:17 PM UTC
  2. PowerBuilder
  3. # 3

...added a check for the Return.... its -1   :-(

now to find out why PB doesn't like the command, where when I issue it straight in a DOS box... it works

 

Comment
  1. mike S
  2. Friday, 6 December 2019 18:23 PM UTC
try it without the quotes around the filename?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.