Tom
Thu May 08 15:35:03 CDT 2008
On May 8, 2:19 pm, "James Whitlow" <jwhitlow.60372...@bloglines.com>
wrote:
> "Tom Lavedas" <tglba...@cox.net> wrote in message
>
> news:b7777d0c-e2a1-4e3a-bb8c-428de2e8d65c@w7g2000hsa.googlegroups.com...
>
>
>
> > On May 7, 4:30 pm, pete0085 <pete0...@discussions.microsoft.com>
> > wrote:
> >> Ok, not sure what I typed in wrong, but nothing happened this time. I
> >> took
> >> your advice and I'll post what I have.
> > {snip}
>
> > NO!! I meant that ALL you needed was JUST THE CODE I POSTED, not that
> > it replaced the rundll part of the old code. However, there was an
> > added problem in that some of the lines I posted clearly wrapped in
> > transit (Oh, and I forgot the Shell creation line).
>
> > Try this ...
>
> > '--------------- Start of code ------------------
> > sPortIP = "198.213.XX.X"
> > sPortName = "IP_198.213.XX.X"
> > sPrtName = "HP LaserJet 4"
> > sPrtDriver = "HP LaserJet 4"
>
> > ' Install the printer, connect the printer and set it as default
> > CreateObject("Wscript.Shell")_
> > .Run "rundll32 printui.dll,PrintUIEntry /q /if /b """ _
> > & sPrtName & """ /c\\" & sPortIP _
> > & " /f %windir%\inf\ntprint.inf /r "_
> > & sPortName & " /m """ & sPrtDriver _
> > & """ /v ""Windows 2000 or XP"" /y", 0, True
> > '--------------- End of code ------------------
>
> > Use this as is, and ONLY this, except for correcting the IP address to
> > the actual ones your printer is on.
>
> Tom, I tried this on 2 different XP Pro computers (admin on one, power
> user on the other). In both cases, nothing happened.
I'm a little out of my depth here. I started with the rundll
statement that you reported as functioning before. The printUI
documentation and the groups.google search examples suggested that the
changes I added should finish the job, but also indicated it was
tricky to get everything just right.
Maybe you can you run it at a command prompt (as a batch procedure) to
see what, if any error codes might be thrown? Remove the /q switch so
that it displays errors. I would do it, but my corporate network
structure makes IP mapping difficult (at least for me). We map ours
for ourselves through a web portal (with persistence). They are not
mapped at login for us.
Now that I look at the statement again, I wonder if there isn't an
error. The /r switch parameter is coded as the PortName, when I think
this might be reserved for the the port address, as in "9100". I
would think the /n switch is used instead to specify the name.
Maybe ...
'--------------- Start of code ------------------
sPortIP = "198.213.XX.X"
sPortName = "IP_198.213.XX.X"
sPrtName = "HP LaserJet 4"
sPrtDriver = "HP LaserJet 4"
' Install the printer, connect the printer and set it as default
CreateObject("Wscript.Shell")_
.Run "rundll32 printui.dll,PrintUIEntry /q /if /b """ _
& sPrtName & """ /c\\" & sPortIP _
& " /f %windir%\inf\ntprint.inf /n "_
& sPortName & " /m """ & sPrtDriver _
& """ /v ""Windows 2000 or XP"" /y", 0, True
'--------------- End of code ------------------
I don't know and really don't have the facilities to test, so maybe I
should just shut my trap now, before I get behinder 8^}
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/