What I am trying to do is use a command line to print a file, which is no big deal. However, it naturally goes to the default printer. This is where the issuse it. I want to be able to print to a specific printer without user intervention (MS)
My thought was to change the default printer using
RunDll32.exe printui.dll,PrintUIEntry /y /n "[Printer Display Name]"
Then I would print my job and then change the default back.
Which should work. However, after I change the default printer I need to change it back. Since I don't know the name of the default printer before I change it, I am stuck.
Is there any easy way to determine it? I have looked and found complex scripts and some Dlls but nothing seems to work right. I like the one Marcus posted that allows you to change the printer, but it dosn't display what is currently the default.
Also, I have found this webpage that has execellent help for RunDll32.exe if anyone is interested
http://www.dx21.com/SCRIPTING/RUNDLL32/REFGUIDE.ASP?P=A
Determine Default Printer
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
How about this:
Code: Select all
RegistryReadKey>HKEY_CURRENT_USER,Software\Microsoft\Windows NT\CurrentVersion\Windows,Device,DefPrinter
Let>DefPrinter={Copy(%DefPrinter%,1,Pos(",",%DefPrinter%)-1)}
MessageModal>DefPrinter
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
How do you know all of this
I would have never though of doing it that way and it works great. I spent 4-5 hours trying to find a way and from posting on this forum to you responded was only 10 minutes. Your support is great.