shrug-l: SOLUTION to Default printer question

Ernie_Roaza@URSCorp.com Ernie_Roaza@URSCorp.com
Fri, 14 Jan 2005 16:17:32 -0500


<FONT face=3D"Default Sans Serif, Verdana, Arial, Helvetica, sans-serif" si=
ze=3D2><DIV>That is correct; hence you need to have shortcut to each applic=
ation.</DIV><DIV>&nbsp;</DIV><DIV>Basically, there's&nbsp;2 methods; either=
 script internal to the application so at startup the application runs it a=
nd also resets to previous printer at exit; OR</DIV><DIV>&nbsp;</DIV><DIV>L=
ike the sample below, change the printer prior to application.; With minor =
modification to the script below, you can just let it popup which printer y=
ou want to use prior to opening an app.</DIV><DIV>&nbsp;</DIV><DIV>However,=
 you really don't use a default printer until you run an application; so is=
 it that important that it is reset to default printer when nothing's going=
 on?&nbsp; that's kind of philosophical..can you hear a tree fall when noon=
e's around to observe it...</DIV><DIV>Don't know jay..if i cook up a better=
 mousetrap, you'll certainly be the first to get it.&nbsp;</DIV><DIV>good w=
eekend everyone!</DIV><DIV>&nbsp;</DIV><DIV>H.&nbsp;Ernie&nbsp;Roaza,&nbsp;=
PG<BR>GIS&nbsp;&amp;&nbsp;Data&nbsp;Management/Hydrogeology<BR>URS&nbsp;Cor=
p.<BR>3676&nbsp;Hartsfield&nbsp;Rd<BR>Tallahassee,&nbsp;FL&nbsp;32303<BR>US=
A<BR><BR><DIV>&nbsp;</DIV><FONT color=3D#990099>-----shrug-l-admin@lists.de=
p.state.fl.us wrote: -----<BR><BR></FONT>To: &lt;Ernie=5FRoaza@urscorp.com&=
gt;<BR>From: "Jay Johnson" &lt;JohnsonJa@mail.co.leon.fl.us&gt;<BR>Sent by:=
 shrug-l-admin@lists.dep.state.fl.us<BR>Date: 01/14/2005 10:59AM<BR>cc: &lt=
;shrug-l@lists.dep.state.fl.us&gt;<BR>Subject: Re: shrug-l: SOLUTION to Def=
ault printer question<BR><BR>Ernie,<BR>Hey - good to hear from you.  If you=
 opened multiple applications with<BR>this method wouldn't the LAST applica=
tion to be opened determine the<BR>default printer for all open application=
s? <BR><BR>Jay Johnson<BR>Leon County Public Works<BR>Tallahassee/Leon Coun=
ty Interlocal GIS<BR>(850) 488-8003<BR><BR>&gt;&gt;&gt; &lt;Ernie=5FRoaza@U=
RSCorp.com&gt; 1/14/2005 10:37:15 AM &gt;&gt;&gt;<BR>Jay: Alternative metho=
d is to use following Windows script hosting<BR>protocol<BR>executed as Vbs=
cript. The WSH protocol is universal to all Windows<BR>2000, XP OS.<BR> <BR=
>1. Open Notepad and enter the following script lines.<BR>2. In line "WshSh=
ell =3D", enter the fullpath to your application exe<BR>file.<BR>3. Save th=
e Notepad file with a (.vbs) extension (not .txt).<BR>4. Make a shortcut of=
 the vbs script in your desktop, and rename to<BR>your application name. ex=
: Word, Excel, etc.<BR>5. Nexttime you use Word or Excel or ArcMap, just do=
uble-click the<BR>short cut.<BR> <BR>The vbscript uses Windows Script Hosti=
ng objects to set<BR>your default printer to whatever; launches your applic=
ation<BR>from a shell and then closes the shell.<BR> <BR>Make a short cut f=
or each of your application and just remember to<BR>use the shortcut instea=
d.  Right click on shortcut and add the icon<BR>image<BR>of the application=
 and you will not be confused.<BR>-----------------------------------------=
-------------<BR>Option Explicit<BR>Dim Objdefprnt,WshShell<BR>'<BR>' Using=
 WsHost script objects to set default printer <BR>' MAKE SURE TO ADD YOUR S=
ERVERNAME AND PRINTERNAME'<BR>' EX: "\\bigorg\HP 8500 LS"<BR>Set Objdefprnt=
 =3D   Wscript.CreateObject("Wscript.Network")<BR>ObjdefArc.SetDefaultPrint=
er "\\Servername\Printername"<BR>'<BR>' Create a WsH shell and run your app=
lications<BR>Set WshShell =3D   Wscript.CreateObject("Wscript.Shell")<BR>'<=
BR>' It is very important to triple quote the fullpath as WSH <BR>' truncat=
es long paths!<BR>WshShell.Run """C:\Program Files\ArcGIS\Bin\ArcMap.exe"""=
<BR>'<BR>' This only echos a message. Not important and can be commented ou=
t.<BR>Wscript.Echo "Set default printer to ..."<BR>'<BR>' Close the shell s=
o you don't have this running as a process<BR>Wscript.quit<BR>-------------=
----------------------------------------------<BR><BR>Good question.  Have =
fun!<BR> <BR>H. Ernie Roaza, PG<BR>GIS &amp; Data Management/Hydrogeology<B=
R>URS Corp.<BR>3676 Hartsfield Rd<BR>Tallahassee, FL 32303<BR>USA<BR><BR>TE=
L:(850) 574-3197<BR>www.urscorp.com <BR><BR><a href=3D"http://lists.dep.sta=
te.fl.us/mailman/listinfo/shrug-l" target=3Dblank>http://lists.dep.state.fl=
.us/mailman/listinfo/shrug-l</a> <BR>=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F<BR>SHRUG-L mailing list<BR>SHRUG-L@lists.dep=
.state.fl.us<BR><a href=3D"http://lists.dep.state.fl.us/mailman/listinfo/sh=
rug-l" target=3Dblank>http://lists.dep.state.fl.us/mailman/listinfo/shrug-l=
</a><BR></DIV></FONT>=