Sign in to follow this  
Followers 0
Granville

Changing Printer Deafults

3 posts in this topic

Hi Folks,

I need to change various printing defaults on locally installed printer drivers. They have to be installed locally, rather than via a server.

Im having a little trouble at the first hurdle. I can get into the printers an faxes window but at that point I cannot work out how to select and edit the properties for the correct printer.

The window info tool doesnt list the names of the printers and each computer may have 1, 2 or 10 other printers already installed.

If one of you super folks has an example script of something similar being done I would be very grateful!

Many thanks,

Paul

Share this post


Link to post
Share on other sites



Hi Folks,

I need to change various printing defaults on locally installed printer drivers. They have to be installed locally, rather than via a server.

Im having a little trouble at the first hurdle. I can get into the printers an faxes window but at that point I cannot work out how to select and edit the properties for the correct printer.

The window info tool doesnt list the names of the printers and each computer may have 1, 2 or 10 other printers already installed.

If one of you super folks has an example script of something similar being done I would be very grateful!

Many thanks,

Paul

Welcome to the forum. The example listed below requires Auto3Lib, which you can download from my signature or from the sticky in the Examples forum. It opens the Printer and Faxes dialog, lists the names of all installed printers and shows you how to open the Properties of the first printer installed. It should give you a base to work from. If you get stuck using Auto3Lib, drop me a line in the Auto3Lib thread in the Examples forum and I'll see if I can help you out.

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

Global $hList, $iI

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

; Get the handle to the ListView control
$hList = ControlGetHandle("Printers and Faxes", "", "SysListView321")
if $hList = 0 then _Lib_ShowError("Unable to get ListView handle")

; Show the names of all the printers (the items are zero based)
for $iI = 1 to _ListView_GetItemCount($hList)
  _Lib_ConsoleWrite(_ListView_GetItemText($hList, $iI))
next

; If we have no printers, stop here
if _ListView_GetItemCount($hList) = 1 then Exit

; Right click on the first printer
_ListView_ClickItem($hList, 1, "right")

; Select the "Properties" item from the popup menu
_Menu_ClickPopupAccel("r")

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Wow,

Exactly what I needed. Looking good so far.

Thankyou very much!

I hope whoever employs you pays you lots of money.

Cheers,

Paul

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