Wrong printer picked up

Wrong printer picked up

Postby Davide » Fri Jul 28, 2006 12:17 am

I'm currently using FWH27, but it's a long time problem even with previous FW(H) versions.

If I have 2 printers with similar long names, for example:
HP Officejet 6200 series fax
HP Officejet 6200 series

PRINT oPrn NAME cName TO "HP Officejet 6200 series" - may pick up the fax one.
The FROM USER clause always works well.

I know that as a workaround you can rename the first one simply as HPFax, but I was wandering if this could be solved definitely.

Thank you,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Wrong printer picked up - SOLVED

Postby Davide » Sun Jan 14, 2007 2:37 am

Davide wrote:If I have 2 printers with similar long names, for example:
HP Officejet 6200 series fax
HP Officejet 6200 series

PRINT oPrn NAME cName TO "HP Officejet 6200 series" - may pick up the fax one.


Solved: In Printer.prg - Function PrintBegin()
Code: Select all  Expand view
nScan := Ascan(aPrn, {|v| Upper(xModel)$Upper(v) })

should be changed as:
Code: Select all  Expand view
nScan := Ascan(aPrn, {|v| Upper(xModel)==Upper(v) })

Antonio, there was a particular reason for searching only part of the printer name in the array ?

Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Sun Jan 14, 2007 7:27 am

Davide,

Yes, because that way you could use just part of a name, i.e.:

PRINT oPrn NAME cName TO "fax"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Davide » Sun Jan 14, 2007 10:31 am

Antonio Linares wrote:PRINT oPrn NAME cName TO "fax"

Uhm, that way if you have more than a printer containing the word "fax" you don't know which one will be picked up.

In addition, even using the TO <entire_printer_name> you may experiencing problems, like in the example I've posted above. More and more all-in-one printers nowadays are installing printer drivers named that way.

Regards,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Richard Chidiak » Sun Jan 14, 2007 5:17 pm

Antonio :(

This is not the correct windows behaviour.

I agree with DAVIDE, we should pick the "exact" printer.

I also have this problem of wrong printer selected, fax returned instead of the printer. In this case, i rename one of the printers...

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Sun Jan 14, 2007 5:55 pm

Davide, Richard,

We can easily modify it as Davide has suggested but I am afraid that we may break existing applications if we change it in FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Sun Jan 14, 2007 7:39 pm

Antonio,

I would vote for fixing the problem even if it breaks some existing applications. You could put a warning in the What's New file. However, it is not me that developers might be upset with if existing apps are broken, so I understand why you would not want to do that.

May I offer a compromise. Add an lExactName var we can set to force it to use exact naming, and default it to false. That way no existing apps will be broken.

The alternative would be to set it to true. Existing apps that are affected would then have to change it to false but it would be a simple fix.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Davide » Mon Jan 15, 2007 11:47 am

Antonio, Richard, James,
Antonio Linares wrote:I am afraid that we may break existing applications if we change it in FWH

what about:
Code: Select all  Expand view
aPrn:=ASORT(aPrn)
nScan := Ascan(aPrn, {|v| Upper(xModel)$Upper(v) })

This way the <exact_printer_name> should be selected because it's found before <exact_printer_name>+" fax", solving both needs.
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Davide » Mon Jan 15, 2007 5:52 pm

even better:
Code: Select all  Expand view
If ( nScan := Ascan(aPrn, {|v| Upper(xModel)==Upper(v) }) ) = 0
  nScan := Ascan(aPrn, {|v| Upper(xModel)$Upper(v) })
Endif

Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Mon Jan 15, 2007 6:33 pm

Davide,

Very good, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Mon Jan 15, 2007 7:14 pm

Davide,

I like your second solution. Nice.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests