Sign in to follow this  
Followers 0
dcjohnston

Get List of printers in a list box..

4 posts in this topic

If you open your printers list and file\ Server properties, then select the Drivers tab, you will see a list of drivers.

I want to select from this box only the printer drivers that start with "HP." I am tasked with removing all HP drivers from 700 workstations.

Is there some way to parse this list to pick out only the ones that start with HP then delete them?

Thanks

Dave

Run("rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder")
WinWaitActive("Printers and Faxes")

Send ( "!f" )
Send ( "t" )

WinWaitActive("Print Server Properties")
;Run ("net stop spooler")


WinWaitactive("Print Server Properties")

Send ( "{tab}" )
Send ( "{tab}" )
Send ( "{tab}" )
Send ( "{tab}" )
Send ( "{tab}" )

Send ( "{RIGHT}" )
Send ( "{RIGHT}" )

Send ( "{tab}" )

Send ( "!e" )



;Run ("net start spooler")

Share this post


Link to post
Share on other sites



If you open your printers list and file\ Server properties, then select the Drivers tab, you will see a list of drivers.

I want to select from this box only the printer drivers that start with "HP." I am tasked with removing all HP drivers from 700 workstations.

Is there some way to parse this list to pick out only the ones that start with HP then delete them?

Thanks

Dave

<snip>

Using Auto3Lib (from my signature):

#include <A3LListView.au3>
#include <A3LMenu.au3>
#include <A3LTabControl.au3>
#include <A3LToolbar.au3>

Opt("MustDeclareVars", 1)

Global $hTool, $hTab, $hList, $iI

; Open "Printer and Faxes" folder
Run("RunDll32.exe Shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder")
_Lib_WinWaitActive("Printers and Faxes")

; Get Toolbar handle to the File menu
$hTool = _Toolbar_FindToolbar("Printers and Faxes", "&File")
if $hTool = 0 then _Lib_ShowError("Unable to find Toolbar")

; Open File menu
_Toolbar_ClickAccel($hTool, "F")

; Open "Server Properties"
_Menu_ClickPopupAccel("t")

; Get handle to Tab Control
$hTab = ControlGetHandle("Print Server Properties", "", "SysTabControl321")
if $hTab = 0 then _Lib_ShowError("Unable to find Tab Control")

; Select "Drivers" tab
_Tab_ClickTab($hTab, 2)

; Get handle to the ListView control
$hList = ControlGetHandle("Print Server Properties", "", "SysListView321")
if $hList = 0 then _Lib_ShowError("Unable to find ListView")

; Enumerate print drivers
for $iI = _ListView_GetItemCount($hList) - 1 to 0 Step -1
  if StringLeft(_ListView_GetItemText($hList, $iI), 2) = "HP" then
    ; Select print driver
    _ListView_ClickItem($hList, $iI)
    ; Press "Delete" button
    ControlClick("Print Server Properties", "", "&Remove")
    ; Answer confirmation
    ControlClick("Print Server Properties", "Deleting this printer driver", "&Yes")
  endif
next

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Hey thanks for the reply, Also for a reply in an obviously wrong forum topic. Woops. :">

I cant wait to try this out. I will download your scripts for the include statements also.

Thanks for your valuable time...

dave

Share this post


Link to post
Share on other sites

Hey thanks for the reply, Also for a reply in an obviously wrong forum topic. Woops. :">

I cant wait to try this out. I will download your scripts for the include statements also.

Thanks for your valuable time...

dave

You're welcome. PM me if you have trouble with the script or using Auto3Lib.

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0