1

I need to set a couple of vars on the Zebra QLn220 belt printer to get it work as we need it to with our app. The first command below (keepPrinterOn) now works:

const string quote = "\"";
string keepPrinterOn = string.Format("! U1 setvar {0}power.dtr_power_off{0} {0}off{0}\r\n", quote);
string advanceToBlackBar = string.Format("! U1 setvar {0}media.sense_mode{0} {0}bar{0}\r\n", quote);
string advanceToGap =          string.Format("! U1 setvar {0}media.sense_mode{0} {0}gap{0}\r\n", quote);

PrintUtils.SendCommandToPrinter(keepPrinterOn);

if (radbtnBar.Checked)
{
    //MessageBox.Show("setting label type to bar");
    AppSettings.WriteSettingsVal("labelType", "bar");
    PrintUtils.SendCommandToPrinter(advanceToBlackBar);
}
else if (radbtnGap.Checked)
{
    //MessageBox.Show("setting label type to gap"); <= This is reached, although printer is not being changed to gap mode at any rate
    AppSettings.WriteSettingsVal("labelType", "gap");
    PrintUtils.SendCommandToPrinter(advanceToGap);
}

Attempting to change the "media.sense_mode" var from bar to gap, though, is failing. Even when radbtnGap is checked, and that (last shown) conditional block of code is entered, the value of the "media.sense_mode" var is not switching from "bar" to "gap" (as seen both empirically, in attempting to print gap (plain) labels, which doesn't work (spews out gazillions of labels after printing one) and by running this command:

! U1 getvar "media.sense_mode"

...in the Zebra Setup Utilities (it returns "bar" even after selecting "gap").

I was previously having problems with these commands because I had neglected to append the crlfs (\r\n) to the commands, as was discussed here [Why would a Zebra QLn220 Printer ignore the first couple of commands sent to it after sending it a command to update some settings?, but now the labels are printed right away after sending the commands above (provided "bar" is selected, and bar (black strip on the back) labels are loaded in the belt printer.

Can anybody make heads or tails (bars or gaps) out of what could be amiss here?

UPDATE

I'm wondering if a low battery can cause commands sent to the printer to not "take." I got a "battery failed" message on the QLn220 (re-charging now). Once I'm able to do so, I'll test it to see if my existing code works (with a charged-up battery). If not, I'll try banno's alternate command in his answer below.

UPDATE 2

So I now have this code (the second two) ready to try, if necessary (the printer is currently dead, and can't even test it):

string advanceToBlackBar = string.Format("! U1 setvar {0}media.sense_mode{0} {0}bar{0}\r\n", quote);
string advanceToGap =      string.Format("! U1 setvar {0}media.sense_mode{0} {0}gap{0}\r\n", quote);
// Alternates added 7/29/2014 in case need to attempt them (see https://stackoverflow.com/questions/24966070/why-would-the-zebra-qln220s-media-sense-mode-var-not-be-set-to-gap-with-this-co)
string advanceToBlackBarAlternate = string.Format("! U1 setvar {0}ezpl.media_type{0} {0}mark{0}\r\n", quote);
string advanceToGapAlternate =      string.Format("! U1 setvar {0}ezpl.media_type{0} {0}web{0}\r\n\r\n", quote);

Is the second pair preferable to the first, or are they simply synonymous / something to try when the other doesn't work?

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

2

Try:

! U1 setvar "ezpl.media_type" "mark"

I think the other one is:

! U1 setvar "ezpl.media_type" "web"

banno
  • 1,529
  • 8
  • 12
  • What do "mark" and "web" signify? I'm willing to try this (once I get a new battery for the at-present-battery-dead QLn220), but those two designations don't seem to make any sense as a correspondency to "bar" and "gap"...??? – B. Clay Shannon-B. Crow Raven Jul 27 '14 at 14:03
  • 1
    Mark is the same as bar and web is gap. – banno Jul 28 '14 at 12:57
  • I will try this when I get a chance, but as of now, the printer is not working. I drained the battery and got a "Battery failed" message. Even after plugging in the charger and getting the battery indicator light to green, it still just gives me a bright empty screen and won't respond to commands sent to it. The Zebra Setup Utilities also does not recognize that it is plugged into it. – B. Clay Shannon-B. Crow Raven Jul 28 '14 at 22:50
  • "U1 " is not necessary between the "! " and the " setvar"? – B. Clay Shannon-B. Crow Raven Jul 28 '14 at 22:51
  • 1
    Do not know how that fell off of my script - edited it to correct it. As for the battery failed message, I would call tech support on that one. – banno Jul 29 '14 at 02:30
  • I contacted them; they seem to think it's not a problem, yet the printer is not functioning at all now, so I beg to differ. – B. Clay Shannon-B. Crow Raven Jul 29 '14 at 14:00
  • We are sending that printer for repair; another printer works fine. So it wasn't my code, after all - it truly was a hardware problem. – B. Clay Shannon-B. Crow Raven Jul 30 '14 at 18:55