Normal Topic Print question (Read 840 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Print question
May 6th, 2009 at 2:40am
Print Post Print Post  
I have searched the forum and learned that AlternateDefaultPrinter works exclusively with the PrintString command family ... is there any way to direct  non-PrintString print jobs via programming to printers other than the client default printer?
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Print question
Reply #1 - May 6th, 2009 at 4:08am
Print Post Print Post  
I found a forum discussion from a year agoabout internally changing default printers on the fly, and used the following code to change my default printer so that sales orders print on a color printer, and then repeats the code at the end of the print job, substituting the original default printer again.

  CreateAProcess("RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n wcColor1")
  Loiter(200)

Thanks, forum!!!
  

Larry
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Print question
Reply #2 - May 6th, 2009 at 5:02pm
Print Post Print Post  
After printing, you want to restore to the default printer. You will run the same code using default Printer name.

RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"

I have been using the command without Loitre, do you have to use Loitre? Well, it is question of two seconds!!!
  
Back to top
 
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Print question
Reply #3 - May 6th, 2009 at 8:17pm
Print Post Print Post  
Hi Bharat,

Yes, I have the followup line to restore the default printer to the original printer.  Thanks.

Also, with all of the code being in the Print button, the 2/10 of a second loiter wasn't enough time for some of my workstations - the print job would send 1-or-2 of the 3 page print job to the original printer before the operating system had time to switch the default printer.  So I'm going to increase the Loiter to (500) which I believe is 1/2 second.  If that doesn't work, I may split up the code - make the first line of code execute in an earlier field in the Order Form (a field that must be entered when it's a new or updated order), and then the second line of code to restore default printer occurs in the print button, at the end of the code for that button.  Of course that isn't foolproof either.  I'll hope a (500) or (600) loiter does the trick.
  

Larry
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Print question
Reply #4 - May 6th, 2009 at 8:40pm
Print Post Print Post  
This is fine but what I have found is even better option is to present the Printer Dialog Box when certain condition is met that present all the printers to choose from. I found it very useful.  Erika has given this code.

http://www.lantica.com/Forum3/cgi-bin/yabb2/YaBB.pl?num=1235163549/10#10
  
Back to top
 
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Print question
Reply #5 - May 6th, 2009 at 10:15pm
Print Post Print Post  
Cool - thanks, Bharat!
  

Larry
Back to top
IP Logged