vmitchell85 Posted March 31, 2010 Posted March 31, 2010 First off this is my first script and I have looked through the help as well as searched on the forums. What I am trying to do is to create a script to install a network printer. I haven't had too many issues that I couldn't figure out but my current issue is selecting the driver to use. I need to select HP on the left list view and then the Laserjet 8150 on the right. I got the ID codes and everything but it wouldn't select. Here is my code, I can post screenshots if needed. Thanks in advance for your assistance. expandcollapse popup; Open Run Send("#r") ; Open Printers WinWaitActive("Run") Send("control printers") Send("{ENTER}") ; Wait for Printer window WinWaitActive("Printers and Faxes") ; Open Add Printer Send("{ALTDOWN}") Send("f") Send("a") Send("{ALTUP}") ; Wait for the window to open WinWaitActive("Add Printer Wizard") ; Hit Next Send("!n") ; Uncheck auto add ControlCommand( "Add Printer Wizard", "&Automatically detect and install my Plug and Play printer", 4665, "UnCheck") ; Hit Next Send("!n") ; Select Create New Port ControlCommand( "Add Printer Wizard", "&Create a new port:", 4558, "Check") ; Select TCP/IP ControlCommand( "Add Printer Wizard", "", 4557, "SelectString", 'Standard TCP/IP Port') ; Hit Next Send("!n") ; Wait for the window to open WinWaitActive("Add Standard TCP/IP Printer Port Wizard") ; Hit Next Send("!n") ; Enter IP Address 10.6.28.131 Send("10.6.28.131") ; Hit Next Send("!n") ; Hit Finish Send("{ENTER}") ; Message to wait for printer lists to appear MsgBox(16, "ATTENTION!", "Click OK when the printer lists have appeared!") WinWaitActive("Add Printer Wizard") ; Navigate to SysListView ID 1580 Send("{TAB}") Send("{TAB}") ; Select HP from list ControlCommand( "Add Printer Wizard", "", 1580, "SelectString", 'HP')
KaFu Posted March 31, 2010 Posted March 31, 2010 (edited) First you can start the wizard directly... ; http://vb.mvps.org/tips/shellcpl.txt run("rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter") Then I would switch from send() to controlsend() functions (use Au3Info.exe to find the correct values for the listviews). Edit: And btw, system listview can only be accessed with the correct output arch, meaning you've got a 64bit windows, then you'll have to compile the script in 64bit and vice versa. Edited March 31, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now