EnumPrinterConnections - Doesnt seem to work 
Author Message
 EnumPrinterConnections - Doesnt seem to work

This is a known bug that will show up in whatever version of WSH you have.
We discovered last week that we weren't really testing the printer functions
from WSH 1.0, the ones we assumed were working. Bad assumption. Basically,
EnumPrinterConnections() only shows DOS printers. The final release of WSH
2.0 will have an EnumPrinterConnections() that will show both DOS and
Windows printers.

I wish I had a workaround for this one - perhaps someone has a control that
lists printers better than we (currently) do? 8)

Mike Whalen
Windows Script Dev


Quote:
> I have created a script that confirms the network connections on startup -
> Drives, printers and user/domain, etc.  (Yes it does have a lot of
> similarity to the Network.vbs script from Microsoft - but I am a newbie)

> However I cannot get the printers to list.  Here are the relevant code
> snippets.

> ______________________________________________________
> CRLF = Chr(13) & Chr(10)
> Set WSHNetwork = WScript.CreateObject("WScript.Network")

> 'Enumerate network drives and Printers into a collection object of type
> WshCollection
> Set colDrives = WSHNetwork.EnumNetworkDrives
> set colPrinters = WSHNetwork.EnumPrinterConnections

> .......

> if colPrinters.Count=0 then
>  strMsg = strMsg & CRLF & "There are no Printers Connected - " &
> colPrinters.Count & CRLF
> Else
>  strMsg = strMsg & "Current Printer Connections:"  & CRLF & CRLF

>  For i=1 to colPrinters.Count-1 step 1
>   strMsg = strMsg & colPrinters(i) & Chr(9) & colPrinters(i + 1) & CRLF
>  Next
> end if
> ____________________________________________________________

> I do have 3 printres connected via the network but cannot get the
> EnumPrinterConnections Method to show any of them.

> Also, I broke the code into a number of Subroutines and then called all 3
> one after the other.  Each subroutine built up a text string to be
displayed
> at the end but this method failed miserably.  Do I need to use functions
to
> send and return the string?

> --
> Gavin Jolly
> Project Engineer/Webmaster
> Ian Smith and Partners        Ph: 0064 4 566 8004
> P.O. Box 30535                   Fax:0064 4 566 8037

> New Zealand                         http://www.*-*-*.com/

> Please visit our Web Site: http://www.*-*-*.com/



Fri, 28 Dec 2001 03:00:00 GMT  
 EnumPrinterConnections - Doesnt seem to work
I have created a script that confirms the network connections on startup -
Drives, printers and user/domain, etc.  (Yes it does have a lot of
similarity to the Network.vbs script from Microsoft - but I am a newbie)

However I cannot get the printers to list.  Here are the relevant code
snippets.

______________________________________________________
CRLF = Chr(13) & Chr(10)
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'Enumerate network drives and Printers into a collection object of type
WshCollection
Set colDrives = WSHNetwork.EnumNetworkDrives
set colPrinters = WSHNetwork.EnumPrinterConnections

.......

if colPrinters.Count=0 then
 strMsg = strMsg & CRLF & "There are no Printers Connected - " &
colPrinters.Count & CRLF
Else
 strMsg = strMsg & "Current Printer Connections:"  & CRLF & CRLF

 For i=1 to colPrinters.Count-1 step 1
  strMsg = strMsg & colPrinters(i) & Chr(9) & colPrinters(i + 1) & CRLF
 Next
end if
____________________________________________________________

I do have 3 printres connected via the network but cannot get the
EnumPrinterConnections Method to show any of them.

Also, I broke the code into a number of Subroutines and then called all 3
one after the other.  Each subroutine built up a text string to be displayed
at the end but this method failed miserably.  Do I need to use functions to
send and return the string?

--
Gavin Jolly
Project Engineer/Webmaster
Ian Smith and Partners        Ph: 0064 4 566 8004
P.O. Box 30535                   Fax:0064 4 566 8037

New Zealand                        http://www.isp.co.nz/staff/gavin.html

Please visit our Web Site: http://www.isp.co.nz



Sat, 29 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why doesn't ENUMPRINTERCONNECTIONS work?

2. Updating record doesnt work?

3. Why Doesnt Work This ChangePicture Function

4. Installed UltraDev now JScript doesnt work

5. HTMLArea with ie5 doesnt work !

6. History.Back doesnt work in Netscape

7. document.FormName.submit() doesnt work???

8. Why Doesnt This Simple Tihng Work?

9. My code doesnt work in Netscape...

10. History.Back in Netscape doesnt work?

11. Script engine doesnt work !

12. Script engine doesnt work

 

 
Powered by phpBB® Forum Software