Jump to content

Install multiple network printers


tlman12
 Share

Recommended Posts

***** Click here for current script ****

A simple script to use, will install multiple network printers using an external printer.inf file.

This script was written for XP but complied and tested in Windows 7 x64 so i'm assuming it will work from at least XP up to and including 7

It uses WMI to get IP, Port, and Printer name information. it then compares it to the input inf to check if:

1. The printer is already there (IP and Driver are the same)

2. The IP address is there(IP is there but driver is wrong) eg you changed out one of your printers and are now updating the driver

3. Deletes and then re-installs printers with the wrong driver.

4. Installs the rest of the printers in the INF

5. Gets a list of printers that were not affected at all by the script.

when all is said and done a completed GUI will appear with a bunch of what i think is useful information and functions:

1. Lists Printers install by script with a Print Test page button

2. Lists Printers that were in the INF but had the correct port and driver information with a Print Test Page button and a Print Properties button (incase you would like to rename the printer)

3. Lists the printers deleted by then reinstalled by the script as their original name

4. Lists printers not touched at all by the script with a Print Test page button a Print Properties button and a Delete printer button. (when you delete the printer it will show up on the deleted printers list)

The script itself is able to accept how ever many entries you would like to put into the inf in this format

IP,IP
Name,Name
Driver.INF,Xerox\Driver.INF
Exact Printer Name out of INF,Xerox WorkCentre Pro 255 PS

Code looks under a folder in the script directory for a folder called "Drivers" so if you put your inf in a different folder like "Xerox" then the inf name would be "Xerox\Driver.INF" no beginning \

I also wrote an INF Creator / Editor to make this process slightly easier same rules apply about the INF name

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>
Dim $ip[28]
Dim $ip_arr[28]
Dim $path[28]
Dim $name[28]
Dim $infname[28]
Dim $path_arr[28]
Dim $name_arr[28]
Dim $infname_arr[28]
Dim $ip2, $path2, $name2, $infname2, $write, $line, $out

$Form1 = GUICreate("INF Editor", 628, 760, -1, -1)

$ip[1] = _GUICtrlIpAddress_Create($Form1, 32, 40, 129, 21)
$path[1] = GUICtrlCreateInput("", 168, 40, 169, 21)
$infname[1] = GUICtrlCreateInput("", 344, 40, 129, 21)
$name[1] = GUICtrlCreateInput("", 480, 40, 129, 21)

$ip[2] = _GUICtrlIpAddress_Create($Form1, 32, 64, 129, 21)
$path[2] = GUICtrlCreateInput("", 168, 64, 169, 21)
$infname[2] = GUICtrlCreateInput("", 344, 64, 129, 21)
$name[2] = GUICtrlCreateInput("", 480, 64, 129, 21)

$ip[3] = _GUICtrlIpAddress_Create($Form1, 32, 88, 129, 21)
$path[3] = GUICtrlCreateInput("", 168, 88, 169, 21)
$infname[3] = GUICtrlCreateInput("", 344, 88, 129, 21)
$name[3] = GUICtrlCreateInput("", 480, 88, 129, 21)

$ip[4] = _GUICtrlIpAddress_Create($Form1, 32, 112, 129, 21)
$path[4] = GUICtrlCreateInput("", 168, 112, 169, 21)
$infname[4] = GUICtrlCreateInput("", 344, 112, 129, 21)
$name[4] = GUICtrlCreateInput("", 480, 112, 129, 21)

$ip[5] = _GUICtrlIpAddress_Create($Form1, 32, 136, 129, 21)
$path[5] = GUICtrlCreateInput("", 168, 136, 169, 21)
$infname[5] = GUICtrlCreateInput("", 344, 136, 129, 21)
$name[5] = GUICtrlCreateInput("", 480, 136, 129, 21)

$ip[6] = _GUICtrlIpAddress_Create($Form1, 32, 160, 129, 21)
$path[6] = GUICtrlCreateInput("", 168, 160, 169, 21)
$infname[6] = GUICtrlCreateInput("", 344, 160, 129, 21)
$name[6] = GUICtrlCreateInput("", 480, 160, 129, 21)

$ip[7] = _GUICtrlIpAddress_Create($Form1, 32, 184, 129, 21)
$path[7] = GUICtrlCreateInput("", 168, 184, 169, 21)
$infname[7] = GUICtrlCreateInput("", 344, 184, 129, 21)
$name[7] = GUICtrlCreateInput("", 480, 184, 129, 21)

$ip[8] = _GUICtrlIpAddress_Create($Form1, 32, 208, 129, 21)
$path[8] = GUICtrlCreateInput("", 168, 208, 169, 21)
$infname[8] = GUICtrlCreateInput("", 344, 208, 129, 21)
$name[8] = GUICtrlCreateInput("", 480, 208, 129, 21)

$ip[9] = _GUICtrlIpAddress_Create($Form1, 32, 232, 129, 21)
$path[9] = GUICtrlCreateInput("", 168, 232, 169, 21)
$infname[9] = GUICtrlCreateInput("", 344, 232, 129, 21)
$name[9] = GUICtrlCreateInput("", 480, 232, 129, 21)

$ip[10] = _GUICtrlIpAddress_Create($Form1, 32, 256, 129, 21)
$path[10] = GUICtrlCreateInput("", 168, 256, 169, 21)
$infname[10] = GUICtrlCreateInput("", 344, 256, 129, 21)
$name[10] = GUICtrlCreateInput("", 480, 256, 129, 21)

$ip[11] = _GUICtrlIpAddress_Create($Form1, 32, 280, 129, 21)
$path[11] = GUICtrlCreateInput("", 168, 280, 169, 21)
$infname[11] = GUICtrlCreateInput("", 344, 280, 129, 21)
$name[11] = GUICtrlCreateInput("", 480, 280, 129, 21)

$ip[12] = _GUICtrlIpAddress_Create($Form1, 32, 304, 129, 21)
$path[12] = GUICtrlCreateInput("", 168, 304, 169, 21)
$infname[12] = GUICtrlCreateInput("", 344, 304, 129, 21)
$name[12] = GUICtrlCreateInput("", 480, 304, 129, 21)

$ip[13] = _GUICtrlIpAddress_Create($Form1, 32, 328, 129, 21)
$path[13] = GUICtrlCreateInput("", 168, 328, 169, 21)
$infname[13] = GUICtrlCreateInput("", 344, 328, 129, 21)
$name[13] = GUICtrlCreateInput("", 480, 328, 129, 21)

$ip[14] = _GUICtrlIpAddress_Create($Form1, 32, 352, 129, 21)
$path[14] = GUICtrlCreateInput("", 168, 352, 169, 21)
$infname[14] = GUICtrlCreateInput("", 344, 352, 129, 21)
$name[14] = GUICtrlCreateInput("", 480, 352, 129, 21)

$ip[15] = _GUICtrlIpAddress_Create($Form1, 32, 376, 129, 21)
$path[15] = GUICtrlCreateInput("", 168, 376, 169, 21)
$infname[15] = GUICtrlCreateInput("", 344, 376, 129, 21)
$name[15] = GUICtrlCreateInput("", 480, 376, 129, 21)

$Label1 = GUICtrlCreateLabel("IP Addresses", 48, 16, 66, 17)
$Label2 = GUICtrlCreateLabel("Driver INF File", 160, 16, 71, 17)
$Label3 = GUICtrlCreateLabel("Printer Name", 488, 16, 65, 17)
$Label4 = GUICtrlCreateLabel("Exact name of printer in INF", 328, 16, 135, 17)


$ip[16] = _GUICtrlIpAddress_Create($Form1, 32, 400, 129, 21)
$path[16] = GUICtrlCreateInput("", 168, 400, 169, 21)
$infname[16] = GUICtrlCreateInput("", 344, 400, 129, 21)
$name[16] = GUICtrlCreateInput("", 480, 400, 129, 21)

$ip[17] = _GUICtrlIpAddress_Create($Form1, 32, 424, 129, 21)
$path[17] = GUICtrlCreateInput("", 168, 424, 169, 21)
$infname[17] = GUICtrlCreateInput("", 344, 424, 129, 21)
$name[17] = GUICtrlCreateInput("", 480, 424, 129, 21)

$ip[18] = _GUICtrlIpAddress_Create($Form1, 32, 448, 129, 21)
$path[18] = GUICtrlCreateInput("", 168, 448, 169, 21)
$infname[18] = GUICtrlCreateInput("", 344, 448, 129, 21)
$name[18] = GUICtrlCreateInput("", 480, 448, 129, 21)

$ip[19] = _GUICtrlIpAddress_Create($Form1, 32, 472, 129, 21)
$path[19] = GUICtrlCreateInput("", 168, 472, 169, 21)
$infname[19] = GUICtrlCreateInput("", 344, 472, 129, 21)
$name[19] = GUICtrlCreateInput("", 480, 472, 129, 21)

$ip[20] = _GUICtrlIpAddress_Create($Form1, 32, 496, 129, 21)
$path[20] = GUICtrlCreateInput("", 168, 496, 169, 21)
$infname[20] = GUICtrlCreateInput("", 344, 496, 129, 21)
$name[20] = GUICtrlCreateInput("", 480, 496, 129, 21)

$ip[21] = _GUICtrlIpAddress_Create($Form1, 32, 520, 129, 21)
$path[21] = GUICtrlCreateInput("", 168, 520, 169, 21)
$infname[21] = GUICtrlCreateInput("", 344, 520, 129, 21)
$name[21] = GUICtrlCreateInput("", 480, 520, 129, 21)

$ip[22] = _GUICtrlIpAddress_Create($Form1, 32, 544, 129, 21)
$path[22] = GUICtrlCreateInput("", 168, 544, 169, 21)
$infname[22] = GUICtrlCreateInput("", 344, 544, 129, 21)
$name[22] = GUICtrlCreateInput("", 480, 544, 129, 21)

$ip[23] = _GUICtrlIpAddress_Create($Form1, 32, 568, 129, 21)
$path[23] = GUICtrlCreateInput("", 168, 568, 169, 21)
$infname[23] = GUICtrlCreateInput("", 344, 568, 129, 21)
$name[23] = GUICtrlCreateInput("", 480, 568, 129, 21)

$ip[24] = _GUICtrlIpAddress_Create($Form1, 32, 592, 129, 21)
$path[24] = GUICtrlCreateInput("", 168, 592, 169, 21)
$infname[24] = GUICtrlCreateInput("", 344, 592, 129, 21)
$name[24] = GUICtrlCreateInput("", 480, 592, 129, 21)

$ip[25] = _GUICtrlIpAddress_Create($Form1, 32, 616, 129, 21)
$path[25] = GUICtrlCreateInput("", 168, 616, 169, 21)
$infname[25] = GUICtrlCreateInput("", 344, 616, 129, 21)
$name[25] = GUICtrlCreateInput("", 480, 616, 129, 21)

$ip[26] = _GUICtrlIpAddress_Create($Form1, 32, 640, 129, 21)
$path[26] = GUICtrlCreateInput("", 168, 640, 169, 21)
$infname[26] = GUICtrlCreateInput("", 344, 640, 129, 21)
$name[26] = GUICtrlCreateInput("", 480, 640, 129, 21)

$ip[27] = _GUICtrlIpAddress_Create($Form1, 32, 664, 129, 21)
$path[27] = GUICtrlCreateInput("", 168, 664, 169, 21)
$infname[27] = GUICtrlCreateInput("", 344, 664, 129, 21)
$name[27] = GUICtrlCreateInput("", 480, 664, 129, 21)

$Label5 = GUICtrlCreateLabel("1", 16, 40, 10, 17)
$Label6 = GUICtrlCreateLabel("2", 16, 64, 10, 17)
$Label7 = GUICtrlCreateLabel("3", 16, 88, 10, 17)
$Label8 = GUICtrlCreateLabel("4", 16, 112, 10, 17)
$Label9 = GUICtrlCreateLabel("5", 16, 136, 10, 17)
$Label10 = GUICtrlCreateLabel("6", 16, 160, 10, 17)
$Label11 = GUICtrlCreateLabel("7", 16, 184, 10, 17)
$Label12 = GUICtrlCreateLabel("8", 16, 208, 10, 17)
$Label13 = GUICtrlCreateLabel("9", 16, 232, 10, 17)
$Label14 = GUICtrlCreateLabel("10", 8, 256, 16, 17)
$Label15 = GUICtrlCreateLabel("11", 8, 280, 16, 17)
$Label16 = GUICtrlCreateLabel("12", 8, 304, 16, 17)
$Label17 = GUICtrlCreateLabel("13", 8, 328, 16, 17)
$Label18 = GUICtrlCreateLabel("14", 8, 352, 16, 17)
$Label19 = GUICtrlCreateLabel("15", 8, 376, 16, 17)
$Label20 = GUICtrlCreateLabel("16", 8, 400, 16, 17)
$Label21 = GUICtrlCreateLabel("17", 8, 424, 16, 17)
$Label22 = GUICtrlCreateLabel("18", 8, 448, 16, 17)
$Label23 = GUICtrlCreateLabel("19", 8, 472, 16, 17)
$Label24 = GUICtrlCreateLabel("20", 8, 496, 16, 17)
$Label25 = GUICtrlCreateLabel("21", 8, 520, 16, 17)
$Label26 = GUICtrlCreateLabel("22", 8, 544, 16, 17)
$Label27 = GUICtrlCreateLabel("23", 8, 568, 16, 17)
$Label28 = GUICtrlCreateLabel("24", 8, 592, 16, 17)
$Label29 = GUICtrlCreateLabel("27", 8, 664, 16, 17)
$Label30 = GUICtrlCreateLabel("26", 8, 640, 16, 17)
$Label31 = GUICtrlCreateLabel("25", 8, 616, 16, 17)


$go = GUICtrlCreateButton("Go!", 40, 696, 233, 49, 0)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
$help = GUICtrlCreateButton("Help?", 360, 696, 233, 49, 0)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW,$Form1)

$Form1_1 = GUICreate("Form1", 316, 340, 0, 0)
$lab1 = GUICtrlCreateLabel("INF File Printer name in INF", 16, 8, 289, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$lab2 = GUICtrlCreateLabel("Xerox1.inf", 40, 40, 64, 17)
$lab3 = GUICtrlCreateLabel("Xerox WorkCentre 5030", 120, 40, 118, 17)
$lab4 = GUICtrlCreateLabel("Xerox2.inf", 40, 176, 83, 17)
$lab5 = GUICtrlCreateLabel("Xerox WorkCentre Pro 245 PS", 120, 176, 148, 17)
$lab6 = GUICtrlCreateLabel("Xerox WorkCentre Pro 255 PS", 120, 192, 148, 17)
$lab7 = GUICtrlCreateLabel("Xerox WorkCentre 5050", 120, 56, 118, 17)
$lab8 = GUICtrlCreateLabel("Xerox WorkCentre Pro 55", 120, 72, 125, 17)
$lab9 = GUICtrlCreateLabel("Xerox WorkCentre Pro 45", 120, 88, 125, 17)
$lab10 = GUICtrlCreateLabel("Xerox WorkCentre Pro 35", 120, 104, 125, 17)
$lab11 = GUICtrlCreateLabel("Xerox WorkCentre M55", 120, 120, 115, 17)
$lab12 = GUICtrlCreateLabel("Xerox WorkCentre M45", 120, 136, 115, 17)
$lab13 = GUICtrlCreateLabel("Xerox WorkCentre M35", 120, 152, 115, 17)
$lab14 = GUICtrlCreateLabel("Xerox WorkCentre Pro 238 PS", 120, 208, 148, 17)
$lab15 = GUICtrlCreateLabel("HP.inf", 55, 232, 65, 17)
$lab16 = GUICtrlCreateLabel("HP LaserJet 4250 PS", 120, 232, 106, 17)
$lab17 = GUICtrlCreateLabel("HP LaserJet 4350 PS", 120, 248, 106, 17)
$lab18 = GUICtrlCreateLabel("Xerox3.inf", 40, 272, 68, 17)
$lab19 = GUICtrlCreateLabel("Xerox WorkCentre Pro 128 PS", 120, 272, 148, 17)
$lab20 = GUICtrlCreateLabel("Xerox WorkCentre M128 PS", 120, 288, 138, 17)

$close = GUICtrlCreateButton("Close", 72, 320, 139, 17)

GUISetState(@SW_HIDE,$form1_1)

;~ GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")
$file = FileOpen("printers.inf", 0)
$ips = FileReadLine($file , 1)
$names = FileReadLine($file, 2)
$paths = FileReadLine($file, 3)
$infnames = FileReadLine($file,4)

$ips = StringSplit($ips, ",")
$paths = StringSplit($paths, ",")
$names = StringSplit($names, ",")
$infnames = StringSplit($infnames, ",")
        If $ips[0] > 27 Then
        MsgBox(16,"Error","The Printers.inf file is too big for this script to edit it completly. Please be aware that when you save you can only manipulate 27 entries with this script. Any further entries will have to be manually edited in the file." & @CRLF & @CRLF & "Program will now exit.")
        Exit
        EndIf
$m = $ips[0] + 1
$i = 0
Do

    $m -= 1
    $i += 1
    _GUICtrlIpAddress_Set($ip[$m], $ips[$i])
    GUICtrlSetData($path[$m], $paths[$i])
    GUICtrlSetData($name[$m], $names[$i])
    GUICtrlSetData($infname[$m], $infnames[$i])

Until $i = $ips[0]
FileClose($file)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            CLOSE()
        Case $help
            GUISetState(@SW_SHOW,$Form1_1)

        Case $close
            GUISetState(@SW_HIDE,$Form1_1)
        Case $go
            $line = ""
            $out = ""
            $write = ""
            If FileExists("printers.inf") Then
                FileCopy("printers.inf","printers.bak",1)
                FileDelete("printers.inf")
            EndIf
            $file = FileOpen("Printers.inf", 1)


            $n = 0
            $e = 0
            Do
                $n += 1
                $ip_arr[$n] = _GUICtrlIpAddress_Get($ip[$n])
                If $ip_arr[$n] = "0.0.0.0" Then
                    $e += 1
                    $ip_arr[$n] = ""
                    $line = $line & "IP on line " & $n & @CRLF
                EndIf
                $path_arr[$n] = GUICtrlRead($path[$n])
                If $path_arr[$n] = "" Then
                    $e += 1
                    $line = $line & "INF Path on line " & $n & @CRLF
                EndIf
                $name_arr[$n] = GUICtrlRead($name[$n])
                If $name_arr[$n] = "" Then
                    $e += 1
                    $line = $line & "Printer Name on line " & $n & @CRLF
                EndIf
                $infname_arr[$n] = GUICtrlRead($infname[$n])
                If $infname_arr[$n] = "" Then
                    $e += 1
                    $line = $line & "INF Name on line " & $n & @CRLF
                EndIf
                If $e = 4 Or $e = 0 Then
                    $e = 0
                    $line = ""
                Else
                    $out = $out & $line
                    $line = ""
                    $write = "No"
                    $e = 0
                EndIf
            Until $n = 27
            If $write = "" Then
            $n = 0
            Do
                $n += 1
                If $ip_arr[$n] = "" Then
                    ContinueLoop
                EndIf
                $ip2 = $ip_arr[$n] & "," & $ip2
                $path2 = $path_arr[$n] & "," & $path2
                $name2 = $name_arr[$n] & "," & $name2
                $infname2 = $infname_arr[$n] & "," & $infname2

            Until $n = 27

            $ip2 = StringTrimRight($ip2, 1)
            $path2 = StringTrimRight($path2, 1)
            $name2 = StringTrimRight($name2, 1)
            $infname2 = StringTrimRight($infname2, 1)
;~          MsgBox(0,"",$infname2)
            FileWriteLine($file, $ip2)
            FileWriteLine($file, $name2)
            FileWriteLine($file, $path2)
            FileWriteLine($file, $infname2)
            FileClose($file)
            MsgBox(0,"Done!",'File "Printers.inf" has been written. Thank you for using scripts by Travis.')
            Exit
        Else
            MsgBox(16,"Error!",'An error occured during processing probably due to a blank input box. Please check and try again.' & @CRLF & $out)
            FileClose($file)
            FileCopy("printers.bak","Printers.inf",1)
        EndIf

    EndSwitch
WEnd


Func CLOSE()
    If WinActive($form1_1) Then
    GUISetState(@SW_HIDE,$Form1_1)
    ElseIf WinActive($form1) Then
    Exit
    EndIf
EndFunc

The INF Editor creator has 27 boxes so if your inf has more then 27 it wont let you edit it.

it has checks in it to make sure that you do not leave any spaces empty :D

They help button is some information i put in to help remind myself, i had 4 separate drivers in one folder and to make it easier i renamed the INF files to Xerox1.INF Xerox2.INF Xerox3.INF and HP.INF, it worked perfectly like this.

finally here is the script

;=========================================
;Install Printers Automaticly
; v 2.0
;by Travis
;=========================================
#include <ProgressConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <GUIListView.au3>
#include <NTServices.au3>

;=========================================
;Declare Variables
;=========================================
Dim $leavelist = "", $dellist = "", $delip = "", $alreadyinstalled = "", $leavename = "", $leavedriver = "", $leaveport = "", $delarr = "", $holdport = ""
Dim $holdname = "", $holdport = "", $holddriver = ""
Dim $i, $pi, $names
;=========================================
;Read the INF file
;=========================================
;Create Arrays
;=========================================
$file = FileOpen("Printers.inf", 0)
$printerip = StringSplit(FileReadLine($file, 1), ",")
$printername = StringSplit(FileReadLine($file, 2), ",")
$printerinf = StringSplit(FileReadLine($file, 3), ",")
$printinfname = StringSplit(FileReadLine($file, 4), ",")
FileClose($file)
;=========================================
;Make Sure C:\temp dir is there
;=========================================
If Not FileExists("C:\temp") Then
    DirCreate("C:\temp")
EndIf
;===================================
;Create Gui
;===================================
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\2892\Desktop\Laptop Script\Source_testing_parts\TL_workspace\In Progress\Install Immk Printers\Main Form.kxf
$Form1 = GUICreate("Install Printers...", 633, 269, -1, -1)
GUISetBkColor(0x3D95FF)
$Label1 = GUICtrlCreateLabel("Installing Printers", 176, 48, 268, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
$Progress = GUICtrlCreateProgress(80, 160, 465, 49)
$Label3 = GUICtrlCreateLabel("Status:", 88, 224, 62, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$status = GUICtrlCreateLabel("a", 152, 224, 374, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Please Wait...", 200, 88, 215, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;===================================
;Check and Deleting old printers
;===================================
GUICtrlSetData($status, "Searching and Deleting old printers") ; Set status
Dim $holddriver = "", $holdname = "", $holdport = "", $p = 0
;Get WMI Printer info
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2")
If @error = "0" Then
    $ComputerSystem = $objWMIService.ExecQuery("Select * from Win32_PRINTER")
    For $objItem In $ComputerSystem
        $name = $objItem.Name
        $port = $objItem.PortName
        $driver = $objItem.DriverName
        $holdport = $port & "," & $holdport
        $holdname = $name & "," & $holdname
        $holddriver = $driver & "," & $holddriver
        $p = $p + 5
        GUICtrlSetData($Progress, $p)
        If $p = 100 Then
            $p = 0
        EndIf
    Next
Else
    MsgBox(16, "Error!", "There was an error accessing WMI. Are you logged on as admin?")
EndIf
$holdport = StringSplit($holdport, ",")
$holdname = StringSplit($holdname, ",")
$holddriver = StringSplit($holddriver, ",")
;==============================
;Get printers already installed
;==============================
Dim $alreadyinstalled = "", $n = 1, $installlist = "", $delip = "", $dellist = "", $leaveport = "", $leavedriver = "", $leavename = ""
Do
    $searcharr = _ArraySearch($holdport, "IP_" & $printerip[$n])
    If $searcharr = -1 Then
        $installlist = $printerip[$n] & "|" & $installlist
        $n += 1
    Else
        If $holddriver[$searcharr] = $printinfname[$n] Then
            $alreadyinstalled = $holdname[$searcharr] & "|" & $alreadyinstalled
            _ArrayDelete($holdport, $searcharr)
            _ArrayDelete($holdname, $searcharr)
            _ArrayDelete($holddriver, $searcharr)
            If StringInStr($delarr, $n) Then
            Else
                $delarr = $n & "|" & $delarr
            EndIf
            $searcharr = _ArraySearch($holdport, "IP_" & $printerip[$n])
            If $searcharr = -1 Then
                $n += 1
            EndIf
        Else
            $dellist = $holdname[$searcharr] & "|" & $dellist
            $delip = $holdport[$searcharr] & "|" & $delip
            _ArrayDelete($holdport, $searcharr)
            _ArrayDelete($holdname, $searcharr)
            _ArrayDelete($holddriver, $searcharr)
            $searcharr = _ArraySearch($holdport, "IP_" & $printerip[$n])
            If $searcharr = -1 Then
                $n += 1
            EndIf
        EndIf
    EndIf
Until $n = $printerip[0] + 1
$holder = StringTrimRight($delarr, 1)
If StringInStr($holder, "|") Then
    $delarr = StringSplit($holder, "|")
Else
    Dim $delarr[2] = [1, $holder]
EndIf
$n = 0
Do
    $n += 1
    If $delarr[$n] = "" Then
    Else
        _ArrayDelete($printerip, $delarr[$n])
        _ArrayDelete($printerinf, $delarr[$n])
        _ArrayDelete($printinfname, $delarr[$n])
        _ArrayDelete($printername, $delarr[$n])
    EndIf
Until $n = $delarr[0]

$delnlb = $dellist
$holdport = _ArrayToString($holdport, "|", 1)
$leaveport = StringSplit($holdport, "|")
$holdname = _ArrayToString($holdname, "|", 1)
$leavename = StringSplit($holdname, "|")
$holddriver = _ArrayToString($holddriver, "|", 1)
$leavedriver = StringSplit($holddriver, "|")
$printerip = _ArrayToString($printerip, "|", 1)
$printerip = StringSplit($printerip, "|")
$printerinf = _ArrayToString($printerinf, "|", 1)
$printerinf = StringSplit($printerinf, "|")
$printername = _ArrayToString($printername, "|", 1)
$printername = StringSplit($printername, "|")
$printinfname = _ArrayToString($printinfname, "|", 1)
$printinfname = StringSplit($printinfname, "|")
$hold = StringTrimRight($dellist, 1)
If $hold = "" Then
Else
    If StringInStr($hold, "|") Then
        $dellist = StringSplit(StringTrimRight($dellist, 1), "|")
        $delip = StringSplit(StringTrimRight($delip, 1), "|")
    Else
        $dellist = StringTrimRight($dellist, 1)
        $delip = StringTrimRight($delip, 1)
    EndIf

    ;============================
    ;Delete Invalid Printers
    ;============================
    If IsArray($dellist) Then
        $p = 0
        $pi = $pi = (100 / $dellist[0])
        $n = 0
        _DelPrintersMulti()
    Else
        $pi = 50
        _DelPrinterSingle()
    EndIf
EndIf
;=============================================================
;Determine if you still have more then one printer to install
;=============================================================
If $printerip[1] = "" Then
Else
    If _ArrayToString($printerip) = $printerip[0] Then
        GUICtrlSetData($status, "Finished")
    Else
        $hold = _ArrayToString($printerip, "|", 1)
        $printerip = StringSplit(_ArrayToString($printerip, "|", 1), "|")

        If $printerip[0] > 1 Then
            $printerinf = StringSplit(_ArrayToString($printerinf, "|", 1), "|")
            $printinfname = StringSplit(_ArrayToString($printinfname, "|", 1), "|")
            $printername = StringSplit(_ArrayToString($printername, "|", 1), "|")
            _InstallPrinter()
        Else

            $holdinf = _ArrayToString($printerinf, "|", 1)
            $holdname = _ArrayToString($printername, "|", 1)
            $holdinfname = _ArrayToString($printinfname, "|", 1)
            Local $printerip[2] = [1, $hold]
            Local $printername[2] = [1, $holdname]
            Local $printerinf[2] = [1, $holdinf]
            Local $printinfname[2] = [1, $holdinfname]
            _InstallPrinter()
        EndIf
    EndIf
EndIf
;========================
;Finished GUI
;========================
GUICtrlSetData($status, "Finished")
$Form2 = GUICreate("Complete", 795, 637, -1, -1)
GUISetBkColor(0x3399FF)
$Label1 = GUICtrlCreateLabel("Printer installation has completed.", 248, 8, 318, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel(" Printers have been installed, Please check to make", 200, 40, 416, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Please use the detailed info below to determin if everything went to plan.", 136, 64, 584, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Printer names should be:", 168, 88, 175, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$installedlist = _GUICtrlListView_Create($Form2, "Installed by Script", 16, 120, 233, 214)
_GUICtrlListView_SetColumnWidth($installedlist, 0, 233)
_GUICtrlListView_SetExtendedListViewStyle($installedlist, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$alreadytherelist = _GUICtrlListView_Create($Form2, "Already Installed", 272, 120, 241, 214)
_GUICtrlListView_SetColumnWidth($alreadytherelist, 0, 241)
_GUICtrlListView_SetExtendedListViewStyle($alreadytherelist, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$Finished = GUICtrlCreateButton("Finished", 312, 568, 161, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$tpibs = GUICtrlCreateButton("Print Test Page", 48, 336, 161, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$tpai = GUICtrlCreateButton("Print Test Page", 392, 336, 121, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$printersdeleted = _GUICtrlListView_Create($Form2, "Deleted Printers", 536, 120, 241, 214)
_GUICtrlListView_SetExtendedListViewStyle($printersdeleted, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
_GUICtrlListView_SetColumnWidth($printersdeleted, 0, 241)
$nottouched = _GUICtrlListView_Create($Form2, "Printer Name", 144, 384, 500, 120)
_GUICtrlListView_SetExtendedListViewStyle($nottouched, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
_GUICtrlListView_SetColumnWidth($nottouched, 0, 180)
_GUICtrlListView_AddColumn($nottouched, "Printer Port/IP", 120)
_GUICtrlListView_AddColumn($nottouched, "Printer Driver", 200)
$tpnt = GUICtrlCreateButton("Print Test Page", 144, 504, 161, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$delprint = GUICtrlCreateButton("Delete Printer", 312, 504, 161, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$printprop = GUICtrlCreateButton("Printer Properties", 480, 504, 161, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$ppai = GUICtrlCreateButton("Printer Properties", 272, 336, 121, 41, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x00FFFF)
$n = 0
If IsArray($leavename) Then
    Do
        $n += 1
        _GUICtrlListView_AddItem($nottouched, $leavename[$n])
    Until $n = $leavename[0]
    $n = 0
    Do
        $n += 1
        _GUICtrlListView_AddSubItem($nottouched, $n - 1, $leaveport[$n], 1)
    Until $n = $leaveport[0]
    $n = 0
    Do
        $n += 1
        _GUICtrlListView_AddSubItem($nottouched, $n - 1, $leavedriver[$n], 2)
    Until $n = $leavedriver[0]
Else
    _GUICtrlListView_AddItem($nottouched, $leavename)
    _GUICtrlListView_AddSubItem($nottouched, 0, $leaveport, 1)
    _GUICtrlListView_AddSubItem($nottouched, 0, $leavedriver, 2)
EndIf
If Not $dellist = "" Then
    If StringInStr($dellist, "|") Then $dellist = StringSplit($dellist, "|")
    If IsArray($dellist) Then
        _ArrayDelete($dellist, 0)
        _GUICtrlListView_AddArray($printersdeleted, $dellist)
    Else
        _GUICtrlListView_AddItem($printersdeleted, $dellist)
    EndIf
EndIf
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$printername = _ArrayToString($printername, "|", 1)
$alreadyinstalled = StringSplit($alreadyinstalled, "|")
If IsArray($alreadyinstalled) Then
    _ArrayDelete($alreadyinstalled, 0)
    _GUICtrlListView_AddArray($alreadytherelist, $alreadyinstalled)
Else
    If Not $alreadyinstalled = "" Then
        _GUICtrlListView_AddItem($alreadytherelist, $alreadyinstalled)
    EndIf
EndIf
If StringInStr($printername, "|") Then $printername = StringSplit($printername, "|")
If IsArray($printername) Then
    _ArrayDelete($printername, 0)
    _GUICtrlListView_AddArray($installedlist, $printername)
Else
    If Not $printername = "" Then
        _GUICtrlListView_AddItem($installedlist, $printername)
    EndIf
EndIf
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _exit()
        Case $Finished
            _exit()
        Case $tpibs
            $name = _GUICtrlListView_GetSelectedIndices($installedlist)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                If IsArray($printername) Then
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $printername[$name] & '"', "", @SW_HIDE)
                Else
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $printername & '"', "", @SW_HIDE)
                EndIf
            EndIf
        Case $ppai
            $name = _GUICtrlListView_GetSelectedIndices($alreadytherelist)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                If IsArray($alreadyinstalled) Then
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /p /n "' & $alreadyinstalled[$name] & '"', "", @SW_HIDE)
                Else
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /p /n "' & $alreadyinstalled & '"', "", @SW_HIDE)
                EndIf
            EndIf
        Case $tpai
            $name = _GUICtrlListView_GetSelectedIndices($alreadytherelist)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                If IsArray($alreadyinstalled) Then
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $alreadyinstalled[$name] & '"', "", @SW_HIDE)
                Else
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $alreadyinstalled & '"', "", @SW_HIDE)
                EndIf
            EndIf
        Case $tpnt
            $name = _GUICtrlListView_GetSelectedIndices($nottouched)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                If IsArray($leavename) Then
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $leavename[$name + 1] & '"', "", @SW_HIDE)
                Else
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /k /n "' & $leavename & '"', "", @SW_HIDE)
                EndIf
            EndIf
        Case $printprop
            $name = _GUICtrlListView_GetSelectedIndices($nottouched)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                If IsArray($leavename) Then
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /p /n "' & $leavename[$name + 1] & '"', "", @SW_HIDE)
                Else
                    RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /p /n "' & $leavename & '"', "", @SW_HIDE)
                EndIf
            EndIf
        Case $delprint
            $name = _GUICtrlListView_GetSelectedIndices($nottouched)
            If $name = "" Then
                MsgBox(16, "Error", "Please select an item in the list above before you click this button")
            Else
                $MsgBox = MsgBox(36, "Delete?", 'Are you sure you would like to delete "' & $leavename[$name + 1] & '"? This action is not reversable.')
                Select
                    Case $MsgBox = 6
                        RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /dl /n "' & $leavename[$name + 1] & '"', "", @SW_HIDE)
                        _GUICtrlListView_DeleteItemsSelected($nottouched)
                        If IsArray($leavename) Then
                            _GUICtrlListView_AddItem($printersdeleted, $leavename[$name + 1])
                            _ArrayDelete($leavename, $name + 1)
                        Else
                            _GUICtrlListView_AddItem($printersdeleted, $leavename)
                        EndIf
                EndSelect
            EndIf
    EndSwitch
WEnd



;===============================
;Start Functions
;===============================
Func _InstallPrinter()
    Local $n = 0
    Local $p = 0
    Local $names = ""
    Local $a = 0
    Do
        $n = $n + 1
        ;===================================
        ;Set Status on GUI
        ;===================================
        $p = 0
        GUICtrlSetData($Progress, $p)
        GUICtrlSetData($status, "Installing " & $printername[$n])
        ;===================================
        ;Right the Registry Values for the IP port
        ;===================================
        $pid = Run('"' & @ComSpec & '" /c net stop "Print Spooler"', '', @SW_HIDE)
        While ProcessExists($pid)
            GUICtrlSetData($Progress, $p)
            $p = $p + 5
            Sleep(1500)
            If $p = 100 Then
                $p = 0
            EndIf
        WEnd
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "Protocol", "REG_DWORD", "00000001")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "Version", "REG_DWORD", "00000001")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "HostName", "REG_SZ", "")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "HWAddress", "REG_SZ", "")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "IPAddress", "REG_SZ", $printerip[$n])
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "PortNumber", "REG_DWORD", "00009100")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "SNMP Community", "REG_SZ", "public")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "SNMP Enabled", "REG_DWORD", "00000001")
        RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_" & $printerip[$n], "SNMP Index", "REG_DWORD", "00000001")
        Sleep(100)
        GUICtrlSetData($Progress, ($p + 5))
        $pid = Run('"' & @ComSpec & '" /c net start "Print Spooler"', '', @SW_HIDE)
        While ProcessExists($pid)
            GUICtrlSetData($Progress, $p)
            $p = $p + 5
            Sleep(1500)
            If $p = 100 Then
                $p = 0
            EndIf
        WEnd
        ;===================================
        ;Install the Printer
        ;===================================
        ;Make sure print spooler is running
        Do
            $sstatus = _ServiceStatus("Spooler")
            If $sstatus = "Running" Then
            Else
                $pid = Run('"' & @ComSpec & '" /c net start "Print Spooler"', '', @SW_HIDE)
                While ProcessExists($pid)
                    GUICtrlSetData($Progress, $p)
                    $p = $p + 5
                    Sleep(1500)
                    If $p = 100 Then
                        $p = 0
                    EndIf
                WEnd
            EndIf
        Until $sstatus = "Running"

        $pid = Run('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /if /b "' & $printername[$n] & '" /f "' & @ScriptDir & '\Drivers\' & $printerinf[$n] & '" /r "IP_' & $printerip[$n] & '" /m "' & $printinfname[$n] & '" /u', "", @SW_HIDE)
        While ProcessExists($pid)
            GUICtrlSetData($Progress, $p)
            $a = $a + 1
            $p = $p + 5
            Sleep(1500)
            If $p = 100 Then
                $p = 0
            EndIf
            If $a = 50 Then
                TrayTip("Not Frozen...", "The script is taking longer then expected, it has not frozen. Please wait for it to complete.", 10, 1)
                $a = 0
            EndIf
            If WinActive("Hardware Installation", "") Then
                Send("{tab}{tab}{enter}")
            EndIf
        WEnd
        $a = 0
        $names = $names & "|" & $printername[$n]
    Until $n = $printername[0]
    GUICtrlSetData($status, "Finished")

EndFunc ;==>_InstallPrinter


Func _DelPrinterSingle()
    If $dellist = "" Then
    ElseIf StringLeft($dellist, 2) = "\\" Then
    Else
        RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /dl /n "' & $dellist & '"', "", @SW_HIDE)
        RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & $delip)
        $p = $p + $pi
        GUICtrlSetData($Progress, $p)
    EndIf
EndFunc ;==>_DelPrinterSingle
Func _DelPrintersMulti()
    Do
        $n += 1
        If $dellist[$n] = "" Then
            ExitLoop
        EndIf
        If StringLeft($dellist[$n], 2) = "\\" Then
            ContinueLoop
        Else
            RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /dl /n "' & $dellist[$n] & '"', "", @SW_HIDE)
            RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\" & $delip[$n])
            $p = $p + $pi
            GUICtrlSetData($Progress, $p)
        EndIf
    Until $n = $dellist[0]
    $dellist = _ArrayToString($dellist, "|", 1)
EndFunc ;==>_DelPrintersMulti

Func _Exit()
    MsgBox(0, "Thank You!", "Thank you for using scripts by Travis. Have a great day!")
    Exit
EndFunc ;==>_Exit

requires NTServices.au3 Copy it and save it as NTServices.au3 in the same folder as the printer installer script

ScreenShots:

Posted Image

Posted Image

Edited by tlman12
Link to comment
Share on other sites

  • 10 months later...
  • 2 weeks later...

requires NTServices.au3 Copy it and save it as NTServices.au3 in the same folder as the printer installer script

It looks like you're using NTServices.au3 just for querying the status of the spooler service.

You might be able to eliminate the dependency with this wmi query.

Func _CheckServiceStatus($szServicename,$sComputer =".")
    Local $sState,$oWMI,$sItems,$oService
    $oWMI = ObjGet("winmgmts:\\" & $sComputer & "\root\cimv2")
    $sItems = $oWMI.ExecQuery("Select * from Win32_Service WHERE name='" & $szServicename & "'")
    For $oService In $sItems
        $sState = $oService.State()
    Next
    $oService = 0
    $oItems = 0
    $oWMI = 0
    Return $sState
EndFunc
Link to comment
Share on other sites

  • 3 weeks later...

when I run it I get

Line 476 (File "C:\Program Files\AutoIt3\Include\GUIListView.au3"):

DllStructSetData($Buffer, "Text", $aItems[$iI][0])
DllStructSetData($Buffer, "Text", ^ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Windows XP SP3. That's what it does when I hit "Run Script"

Link to comment
Share on other sites

  • 3 months later...

sorry this was a pesky error that i got with the include guilistbox.au3 include.

the quick fix was to change the include.. but i actually had wrote a 3.0 version to this.. i just completely forgot about this post.

i'll try to dig it up, i've been switching most of my focus towards Visual Basic because of it's easily distributable/maintainable nature

Found it, i uploaded it to mega upload http://www.megaupload.com/?d=6T0AKJLO i forget where i had this one to but im pretty sure i had it working in windows 7 x64 (with compatible drivers) it's 10.35Mb because i included the drivers i was using to test, you can obviously substitute your own as you please

Posted Image

Posted Image

Posted Image

this one also includes an INI editor (i switched from using inf because i switched the way the program reads)

and a converter if you've already created a custom INF file

Posted Image

enjoy,

apparently i'm not monitoring this post anymore.. but if you PM me i'll see the e-mail and i'll respond to any problems you may have.

Edited by tlman12
Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...

for all who have requested this script here is my latest update. it's pretty close to a ground up rewrite and still has some bugs.

new features are, better logging, easier printer.ini creator (allows you to select the printer from the ini instead of having to know the printer name), allows you to install printers on LPT/COM and Local Ports.

should be more reliable.

known issues:

Install Selected not implemented

Not platform independent (you must create an INI for x64 and an INI for x86 if you have both in your environment)

I've never used 4shared before so i'm not sure if you'll be able to access these links or not but here they are.

1st http://www.4shared.com/zip/_O1S5v7c/Printerinstaller.html?

2nd http://www.4shared.com/zip/cvCCZrxb/PrinterInstaller_noDriver.html?

the first link just gives a couple xerox and hp drivers i was using to test, the second link has no included drivers so is a much smaller download.

let me know if you run into any other bugs, I'm busy with a full time job and other responsibilities so i only get "tinker time" with scripts anymore not the ammount of time i used to be able to devote to them.

**** THIS IS CONSIDERED TO BE AN ALPHA / BETA RELEASE. I ASSUME NO RESPONSIBILITY FOR ANY DAMAGE CAUSED BY THIS SCRIPT. PLEASE TEST ON A VIRTUAL MACHINE OR A TEST MACHINE BEFORE DEPLOYING ON A BROADER SCALE, THANK YOU ****

Link to comment
Share on other sites

  • 3 months later...

To the OP, please use a site for your downloads that doesn't make it nearly impossible to find the download link to the correct file. I must have clicked on 6 different download buttons and none of them served up your file(s).

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 2 weeks later...

I have a good news:

Printer installed with this script is actually printing.

And I've found some bugs:

Button "Install selected" just doesn't work. (but I had only one printer in your Windows Instaler GUI)

There were already installed some printers in my Windows 7 system. When I first time pressed "Install All" there were an error message "failed to stop printer spooler". I pressed it again after 10 sec and It was OK.

p.s and here another bug. If you run PrintINI creator.exe > File >Open INI >cancel script shows error message

Edited by minimen456
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

I try running it and I get:

>Running AU3Check (3.3.14.1)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\rfadmin\Desktop\example.au3
"C:\Program Files (x86)\AutoIt3\Include\NTServices.au3"(24,42) : error: $STANDARD_RIGHTS_REQUIRED previously declared as a 'Const'.
Const $STANDARD_RIGHTS_REQUIRED = 0xF0000
 

 

Can you help.

 

 

Link to comment
Share on other sites

I'm going to guess that some of the files used in this have been updated in the past 6 years and you'll need to get it to work in 3.3.14.0.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...