shrug-l: SOLUTION to Default printer question

Jay Johnson
Fri, 14 Jan 2005 10:59:08 -0500

Hey - good to hear from you.  If you opened multiple applications with
this method wouldn't the LAST application to be opened determine the
default printer for all open applications? 

Jay Johnson
Leon County Public Works
Tallahassee/Leon County Interlocal GIS
(850) 488-8003

>>> <> 1/14/2005 10:37:15 AM >>>
Jay: Alternative method is to use following Windows script hosting
executed as Vbscript. The WSH protocol is universal to all Windows
2000, XP OS.
1. Open Notepad and enter the following script lines.
2. In line "WshShell =", enter the fullpath to your application exe
3. Save the Notepad file with a (.vbs) extension (not .txt).
4. Make a shortcut of the vbs script in your desktop, and rename to
your application name. ex: Word, Excel, etc.
5. Nexttime you use Word or Excel or ArcMap, just double-click the
short cut.
The vbscript uses Windows Script Hosting objects to set
your default printer to whatever; launches your application
from a shell and then closes the shell.
Make a short cut for each of your application and just remember to
use the shortcut instead.  Right click on shortcut and add the icon
of the application and you will not be confused.
Option Explicit
Dim Objdefprnt,WshShell
' Using WsHost script objects to set default printer 
' EX: "\\bigorg\HP 8500 LS"
Set Objdefprnt = Wscript.CreateObject("Wscript.Network")
ObjdefArc.SetDefaultPrinter "\\Servername\Printername"
' Create a WsH shell and run your applications
Set WshShell = Wscript.CreateObject("Wscript.Shell")
' It is very important to triple quote the fullpath as WSH 
' truncates long paths!
WshShell.Run """C:\Program Files\ArcGIS\Bin\ArcMap.exe"""
' This only echos a message. Not important and can be commented out.
Wscript.Echo "Set default printer to ..."
' Close the shell so you don't have this running as a process

Good question.  Have fun!
H. Ernie Roaza, PG
GIS & Data Management/Hydrogeology
URS Corp.
3676 Hartsfield Rd
Tallahassee, FL 32303

TEL:(850) 574-3197