$version = "1.0" $driverversion = "7.09" $filename="1800198F.exe" ; dont forget to change the FileInstall line as well becuase of AutoIt limitations it cant be a variable $totaldevices = 14 $historysearch = 'v 7.09 1/5/05' ;-------------------------------------------------------------- dim $models[($totaldevices +1)] $models[0] = ($totaldevices +1) $counter = 0 Do $models[$counter] = 0 $counter = $counter + 1 Until $counter = ($models[0] + 1) ; parse command line args global $agree, $install ParseArgs() ; Give the user a warning and ask if its ok to continue. If $agree <> 1 Then $continue = MsgBox(4, "Comtrol Unofficial/Unsupported DeviceMaster Installation Script "& $version, "This script will install multiple DeviceMasters for Windows 2000/XP/2003 only."&@CRLF&"By continuing you can not hold Comtrol responsible for any damage/loss to hardware/software/data."&@CRLF&"Please backup your system!"&@CRLF&@CRLF&"Do you wish to continue?") If $continue = 7 OR $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit EndIf EndIf ; Check to make sure dependencies are met for the application ; In this case I include the driver with the installer If @compiled Then If NOT FileInstall("1800198F.exe", $filename, 1) Then MsgBox(0, "File Installation Error", "This script could not copy '"&$filename&"' to the same directory the script is in.") Exit EndIf EndIf If $install <> 1 Then $driverdir = InputBox("DeviceMaster Installer Script " & $version, "What directory should the DeviceMaster "&$driverversion&" driver exist in?" & @CRLF & @CRLF & "For example C:\Comtrol" & @CRLF, "C:\Comtrol", "", 400, 150) Else $driverdir = "C:\Comtrol" EndIf If @Error = 1 Then Exit If NOT SearchFiles($driverdir, "HISTORY.TXT", $historysearch) Then ; Give the user a warning and ask if its ok to continue. If $install <> 1 Then $continue = MsgBox(3, "Driver not detected", "I could not detect the correct Comtrol driver at "&$driverdir&@CRLF&@CRLF&" Yes) Installs driver automatically now"&@CRLF&" No) Continues the DeviceMaster install without driver"&@CRLF&" Cancel) Quits all installs and exits") Else $continue = 6 EndIf If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit ElseIf $continue = 6 Then Run(@ScriptDir & '\' & $filename) ;WinZip Self-Extractor - $filename WinWait("WinZip Self-Extractor - "&$filename) If Not WinActive("WinZip Self-Extractor - "&$filename) Then WinActivate("WinZip Self-Extractor - "&$filename) WinWaitActive("WinZip Self-Extractor - "&$filename) Send("!f") Send($driverdir) Send("!u") WinWait("WinZip Self-Extractor", "unzipped successfully") If Not WinActive("WinZip Self-Extractor","unzipped successfully") Then WinActivate("WinZip Self-Extractor", "unzipped successfully") WinWaitActive("WinZip Self-Extractor","unzipped successfully") Send("{SPACE}") If Not WinActive("WinZip Self-Extractor - "&$filename) Then WinActivate("WinZip Self-Extractor - "&$filename) WinWaitActive("WinZip Self-Extractor - "&$filename) Send("!c") EndIf EndIf ; if commandline installation options specified, then dont display any gui stuff. If $install <> 1 Then $badchoicemsg = "" $bLoop = 1 While $bLoop = 1 $choice = 0 ;InputBox( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] ) $choice = InputBox("Product Choice", "Choose a product from the "&$driverversion&" driver:" & @CRLF & _ " 0) Done selecting devices to install!" & @CRLF & _ " 1) DeviceMaster AIR" &@TAB&@TAB& $models[1] & @CRLF & _ " 2) DeviceMaster Pro 16" &@TAB&@TAB& $models[2] & @CRLF & _ " 3) DeviceMaster Pro 8" &@TAB&@TAB& $models[3] & @CRLF &_ " 4) DeviceMaster RTS 1" &@TAB&@TAB& $models[4] & @CRLF & _ " 5) DeviceMaster RTS 16" &@TAB& $models[5] & @CRLF & _ " 6) DeviceMaster RTS 32" &@TAB& $models[6] & @CRLF & _ " 7) DeviceMaster RTS 4" &@TAB&@TAB& $models[7] & @CRLF & _ " 8) DeviceMaster RTS 8" &@TAB&@TAB& $models[8] & @CRLF & _ " 9) DeviceMaster SerialHub 16" &@TAB& $models[9] & @CRLF & _ " 10) DeviceMaster SerialHub 8" &@TAB& $models[10] & @CRLF & _ " 11) RocketPort SerialHub IA 2" &@TAB& $models[11] & @CRLF & _ " 12) RocketPort SerialHub SI 2" &@TAB& $models[12] & @CRLF & _ " 13) RocketPort SerialHub SI 4" &@TAB& $models[13] & @CRLF & _ " 14) RocketPort SerialHub SI 8" &@TAB& $models[14] & @CRLF & _ @CRLF & @CRLF & "Please choose a number and press enter", $badchoicemsg, "", -1, 350) If @error = 1 Then Exit Else Select Case $choice = 0 $ports = 1 $bLoop = 0 Case $choice = 1 $product = "DeviceMaster AIR" $ports = 1 Case $choice = 2 $product = "DeviceMaster Pro 16" $ports = 16 Case $choice = 3 $product = "DeviceMaster Pro 8" $ports = 8 Case $choice = 4 $product = "DeviceMaster RTS 1" $ports = 1 Case $choice = 5 $product = "DeviceMaster RTS 16" $ports = 16 Case $choice = 6 $product = "DeviceMaster RTS 32" $ports = 32 Case $choice = 7 $product = "DeviceMaster RTS 4" $ports = 4 Case $choice = 8 $product = "DeviceMaster RTS 8" $ports = 8 Case $choice = 9 $product = "DeviceMaster SerialHub 16" $ports = 16 Case $choice = 10 $product = "DeviceMaster SerialHub 8" $ports = 8 Case $choice = 11 $product = "RocketPort SerialHub IA 2" $ports = 2 Case $choice = 12 $product = "RocketPort SerialHub SI 2" $ports = 2 Case $choice = 13 $product = "RocketPort SerialHub SI 4" $ports = 4 Case $choice = 14 $product = "RocketPort SerialHub SI 8" $ports = 8 Case Else $badchoicemsg = "Invalid choice selected!" EndSelect EndIf If ($badchoicemsg = "" And $choice <> 0) Then $badamountmsg = "" $amount = InputBox("How Many?", "Enter the number of " & $product & "'s you want installed", $badamountmsg, "", 300, 150) If @error = 1 Then Exit Else Select Case Number($amount) = 0 $bLoop = 0 Case Number($amount) > 0 $models[$choice] = $amount Case Else $badamountmsg = "Invalid selection! Please enter a number." EndSelect EndIf EndIf WEnd EndIf ;install gui test For $counter1 = 1 To $totaldevices Step 1 $counter2 = 0 While $counter2 < $models[$counter1] Select Case (@OSVersion = "WIN_XP" And @OSBuild = "3790") $result = InstallWin2003($counter1) Case @OSVersion = "WIN_2000" $result = InstallWin2000($counter1) Case @OSVersion = "WIN_XP" $result = InstallWinXP($counter1) Case Else MsgBox(0, "OS Not Supported", "Very sorry, this OS is not currently supported.") Exit EndSelect If $result = 0 Then $counter2 = $counter2 + 1 WEnd Next SplashOff() If $install <> 1 Then MsgBox(0, "Complete", "DeviceMaster Installation(s) Complete") EndIf Exit Func ParseArgs () For $counter = 1 To $CmdLine[0] Step 1 If $CmdLine[$counter] = "-help" Or $CmdLine[$counter] = "--help" Or $CmdLine[$counter] = "/?" Then MsgBox(0, "Comtrol Unofficial/Unsupported DeviceMaster Installer", _ "Usage: " & @scriptname & " [-help] [-agree] [-install ]" & @CRLF & _ @CRLF & _ "This script will install multiple DeviceMasters for Windows 2000/XP/2003 only."&@CRLF&"By continuing you can not hold Comtrol responsible for any damage/loss to hardware/software/data."&@CRLF &_ @CRLF & _ "Options:" @CRLF & _ " -help This screen" & @CRLF & _ " -agree You already agree to the disclaimer, do not prompt me again." & @CRLF & _ " -install Install DeviceMasters. Also assuming you want the driver extracted to C:\Comtrol!" & @CRLF & _ " Get model number from graphical mode listing."& @CRLF & _ " Count is number of DeviceMasters to install" & @CRLF & _ ) exit EndIf If $CmdLine[$counter] = "-agree" Then $agree = 1 EndIf If $CmdLine[$counter] = "-install" Then $install = 1 $models[$CmdLine[($counter+1)]] = $CmdLine[($counter+2)] EndIf Next EndFunc Func InstallWin2003 ($model) $checkforsignatures = 1 $portsignatures = 0 $done = 0 $count = 0 $didsomething = 0 $splashon = 0 $onceSelectDriver = 0 ; Launch Add New Hardware Wizard $HWPID = Run(@ComSpec & " /c" & @WindowsDir & "\system32\hdwwiz.cpl",) ;Run(@WindowsDir & "\system32\hdwwiz.cpl",) While $done = 0 If WinExists("Cannot Run Two Device Installations","You can install only one device at a time") Then SplashOff() If Not WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then WinActivate("Add Hardware Wizard","") If WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then Send("{SPACE}") Return 1 EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then SplashOff() If Not WinActive("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Is the hardware connected? If WinExists("Add Hardware Wizard","Have you already connected this hardware") Then SplashOff() If Not WinActive("Add Hardware Wizard","Have you already connected this hardware") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","Have you already connected this hardware") Then Send("!y") Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Choose a Hardware Task screen If WinExists("Add Hardware Wizard","From the list below, select") Then SplashOff() If Not WinActive("Add Hardware Wizard","From the list below, select") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","From the list below, select") Then Send("{END}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Search or manual? If WinExists("Add Hardware Wizard","The wizard can search for other hardware") Then SplashOff() If Not WinActive("Add Hardware Wizard","The wizard can search for other hardware") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","The wizard can search for other hardware") Then Send("!m") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware Type If WinExists("Add Hardware Wizard","If you do not see the hardware category") Then SplashOff() If Not WinActive("Add Hardware Wizard","If you do not see the hardware category") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","If you do not see the hardware category") Then Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then Send("{TAB}") Send("{TAB}") For $choiceselection = 1 To ($model-1) Step 1 Send ("{DOWN}") Next Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With no white in the middle If WinExists("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var <> 16777215 Then Send("!h") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Searching for hardware If WinExists("Add Hardware Wizard","This wizard is searching for hardware") Then SplashOff() ;If Not WinActive("Add Hardware Wizard","The wizard is searching for hardware") Then WinActivate("Add/Remove Hardware Wizard","The wizard is searching for hardware") $didsomething = $didsomething + 1 $count = 0 EndIf ; Have Disk to Comtrol folder If WinExists("Install From Disk","") Then SplashOff() If Not WinActive("Install From Disk","") Then WinActivate("Install From Disk","") If WinActive("Install From Disk","") Then Send("!c") Send($driverdir) Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Start Hardware Installation If WinExists("Add Hardware Wizard","Hardware to install") Then SplashOff() If Not WinActive("Add Hardware Wizard","Hardware to install") Then WinActivate("Add Hardware Wizard","Hardware to install") If WinActive("Add Hardware Wizard","Hardware to install") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware Installation If WinExists("Hardware Installation","")Then SplashOff() If Not WinActive("Hardware Installation","") Then WinActivate("Hardware Installation","") If WinActive("Hardware Installation","") Then Send("!c") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Software Installation If WinExists("Software Installation","") Then SplashOff() If Not WinActive("Software Installation","") Then WinActivate("Software Installation","") If WinActive("Software Installation","") Then Send("!c") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Completed If WinExists("Add Hardware Wizard","The following hardware was installed") Then SplashOff() If Not WinActive("Add Hardware Wizard","The following hardware was installed") Then WinActivate("Add Hardware Wizard","The following hardware was installed") If WinActive("Add Hardware Wizard","The following hardware was installed") Then Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Found New Hardware Wizard If WinExists("Found New Hardware Wizard","Can Windows connect to Windows Update") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Can Windows connect to Windows Update") Then WinActivate("Found New Hardware Wizard","Can Windows connect to Windows Update") If WinActive("Found New Hardware Wizard","Can Windows connect to Windows Update") Then Send("!t") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Found New Hardware Wizard", "This wizard helps you install software for") Then SplashOff() If Not WinActive("Found New Hardware Wizard","This wizard helps you install software for") Then WinActivate("Found New Hardware Wizard","This wizard helps you install software for") If WinActive("Found New Hardware Wizard","This wizard helps you install software for") Then Send("!s") Send("!n") ;WinWait("Found New Hardware Wizard","This wizard will complete the installation for this device") ;If Not WinActive("Found New Hardware Wizard","") Then WinActivate("Found New Hardware Wizard","") ;WinWaitActive("Found New Hardware Wizard","") ;ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "Check", "") ;ControlCommand("Found New Hardware Wizard", "", "Floppy &disk drives", "UnCheck", "") ;ControlCommand("Found New Hardware Wizard", "", "&CD-ROM drives", "UnCheck", "") ;ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "UnCheck", "") ;Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Chose search and installation options If WinExists("Found New Hardware Wizard","Don't search. I will choose the driver") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Don't search. I will choose the driver") Then WinActivate("Found New Hardware Wizard","Don't search. I will choose the driver") If WinActive("Found New Hardware Wizard","Don't search. I will choose the driver") Then Send("!d") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Completed If WinExists("Found New Hardware Wizard","The wizard has finished") Then SplashOff() If Not WinActive("Found New Hardware Wizard","The wizard has finished") Then WinActivate("Found New Hardware Wizard","The wizard has finished") If WinActive("Found New Hardware Wizard","The wizard has finished") Then Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Add Hardware Wizard","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Found New Hardware Wizard","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open AutoItSetOption("WinTitleMatchMode", 4) If WinExists("Comtrol NS Link Port","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf AutoItSetOption("WinTitleMatchMode", 1) ; Hardware wizard still open ;classname=Shell_TrayWnd ;AutoItSetOption("WinTitleMatchMode", 4) ;If WinExists("classname=tooltips_class32") Then ; SplashOff() ; $didsomething = $didsomething + 1 ; $count = 0 ; EndIf ; AutoItSetOption("WinTitleMatchMode", 1) ; If the hardware wizard process is still running then dont exit If ProcessExists($HWPID) Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf If $didsomething = 0 Then If $count >= 40 Then $done = 1 Else $count = $count + 1 $countdown = int((40 - $count) /4) Sleep(250) EndIf If $splashon Then ControlSetText("Waiting for Hardware Wizard", "", "Static1", "Waiting to be sure hardware wizard is complete... $countdown seconds remain...") Else SplashTextOn("Waiting for Hardware Wizard", "Waiting to be sure hardware wizard is complete... "&$countdown&" seconds remain...", 550, 50) EndIf Else ;$continue = MsgBox(3, "DEBUG", "Pausing cause we saw a window and did something...") ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit EndIf $didsomething = 0 WEnd EndFunc Func InstallWinXP ($model) $checkforsignatures = 1 $portsignatures = 0 $done = 0 $count = 0 $didsomething = 0 $splashon = 0 $onceSelectDriver = 0 ; Launch Add New Hardware Wizard $HWPID = Run(@ComSpec & " /c" & @WindowsDir & "\system32\hdwwiz.cpl",) ;Run(@WindowsDir & "\system32\hdwwiz.cpl",) While $done = 0 If WinExists("Cannot Run Two Device Installations","You can install only one device at a time") Then SplashOff() If Not WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then WinActivate("Add Hardware Wizard","") If WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then Send("{SPACE}") Return 1 EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then SplashOff() If Not WinActive("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","Welcome to the Add Hardware Wizard") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Is the hardware connected? If WinExists("Add Hardware Wizard","Have you already connected this hardware") Then SplashOff() If Not WinActive("Add Hardware Wizard","Have you already connected this hardware") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","Have you already connected this hardware") Then Send("!y") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Choose a Hardware Task screen If WinExists("Add Hardware Wizard","From the list below, select") Then SplashOff() If Not WinActive("Add Hardware Wizard","From the list below, select") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","From the list below, select") Then Send("{END}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Search or manual? If WinExists("Add Hardware Wizard","The wizard can search for other hardware") Then SplashOff() If Not WinActive("Add Hardware Wizard","The wizard can search for other hardware") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","The wizard can search for other hardware") Then Send("!m") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware Type If WinExists("Add Hardware Wizard","If you do not see the hardware category") Then SplashOff() If Not WinActive("Add Hardware Wizard","If you do not see the hardware category") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","If you do not see the hardware category") Then Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then ;Send("!n") Send("{TAB}") Send("{TAB}") For $choiceselection = 1 To ($model-1) Step 1 Send ("{DOWN}") Next Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With no white in the middle If WinExists("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Add Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var <> 16777215 Then Send("!h") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") If WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Searching for hardware If WinExists("Add Hardware Wizard","This wizard is searching for hardware") Then SplashOff() ;If Not WinActive("Add Hardware Wizard","The wizard is searching for hardware") Then WinActivate("Add/Remove Hardware Wizard","The wizard is searching for hardware") $didsomething = $didsomething + 1 $count = 0 EndIf ; Have Disk to Comtrol folder If WinExists("Install From Disk","") Then SplashOff() If Not WinActive("Install From Disk","") Then WinActivate("Install From Disk","") If WinActive("Install From Disk","") Then Send("!c") Send($driverdir) Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Start Hardware Installation If WinExists("Add Hardware Wizard","Hardware to install") Then SplashOff() If Not WinActive("Add Hardware Wizard","Hardware to install") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","Hardware to install") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware Installation If WinExists("Hardware Installation","")Then SplashOff() If Not WinActive("Hardware Installation","") Then WinActivate("Hardware Installation","") If WinActive("Hardware Installation","") Then Send("!c") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Software Installation If WinExists("Software Installation","") Then SplashOff() If Not WinActive("Software Installation","") Then WinActivate("Software Installation","") If WinActive("Software Installation","") Then Send("!c") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Completed If WinExists("Add Hardware Wizard","The following hardware was installed") Then SplashOff() If Not WinActive("Add Hardware Wizard","The following hardware was installed") Then WinActivate("Add Hardware Wizard","") If WinActive("Add Hardware Wizard","The following hardware was installed") Then Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Found New Hardware Wizard If WinExists("Found New Hardware Wizard","Can Windows connect to Windows Update") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Can Windows connect to Windows Update") Then WinActivate("Found New Hardware Wizard","") If WinActive("Found New Hardware Wizard","Can Windows connect to Windows Update") Then Send("!t") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Found New Hardware Wizard", "This wizard helps you install software for") Then SplashOff() If Not WinActive("Found New Hardware Wizard","This wizard helps you install software for") Then WinActivate("Found New Hardware Wizard","This wizard helps you install software for") If WinActive("Found New Hardware Wizard","This wizard helps you install software for") Then Send("!s") Send("!n") ;WinWait("Found New Hardware Wizard","This wizard will complete the installation for this device") ;If Not WinActive("Found New Hardware Wizard","") Then WinActivate("Found New Hardware Wizard","") ;WinWaitActive("Found New Hardware Wizard","") ;ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "Check", "") ;ControlCommand("Found New Hardware Wizard", "", "Floppy &disk drives", "UnCheck", "") ;ControlCommand("Found New Hardware Wizard", "", "&CD-ROM drives", "UnCheck", "") ;ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "UnCheck", "") ;Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Chose search and installation options If WinExists("Found New Hardware Wizard","Don't search. I will choose the driver") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Don't search. I will choose the driver") Then WinActivate("Found New Hardware Wizard","") If WinActive("Found New Hardware Wizard","Don't search. I will choose the driver") Then Send("!d") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Completed If WinExists("Found New Hardware Wizard","The wizard has finished") Then SplashOff() If Not WinActive("Found New Hardware Wizard","The wizard has finished") Then WinActivate("Found New Hardware Wizard","") If WinActive("Found New Hardware Wizard","The wizard has finished") Then Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Add Hardware Wizard","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Found New Hardware Wizard","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Comtrol NS Link Port","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; If the hardware wizard process is still running then dont exit If ProcessExists($HWPID) Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf If $didsomething = 0 Then If $count >= 40 Then $done = 1 Else $count = $count + 1 $countdown = int((40 - $count) /4) Sleep(250) EndIf If $splashon Then ControlSetText("Waiting for Hardware Wizard", "", "Static1", "Waiting to be sure hardware wizard is complete... $countdown seconds remain...") Else SplashTextOn("Waiting for Hardware Wizard", "Waiting to be sure hardware wizard is complete... "&$countdown&" seconds remain...", 550, 50) EndIf Else ;$continue = MsgBox(3, "DEBUG", "Pausing cause we saw a window and did something...") ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit EndIf $didsomething = 0 WEnd EndFunc Func InstallWin2000 ($model) $checkforsignatures = 1 $portsignatures = 0 $done = 0 $count = 0 $didsomething = 0 $splashon = 0 ; Launch Add New Hardware Wizard ;$HWPID = Run(@ComSpec & " /c" & @WindowsDir & "\system32\hdwwiz.cpl",) Local $RUNDLL32 = @SystemDir & "\rundll32.exe" ;$HWPID = Run($RUNDLL32 SHELL32.DLL,Control_RunDLL hdwwiz.cpl) $HWPID = Run($RUNDLL32 & " shell32.dll,Control_RunDLL hdwwiz.cpl") ;Run(@WindowsDir & "\system32\hdwwiz.cpl",) While $done = 0 If WinExists("Cannot Run Two Device Installations","You can install only one device at a time") Then SplashOff() If Not WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then WinActivate("Add Hardware Wizard","") If WinActive("Cannot Run Two Device Installations","You can install only one device at a time") Then Send("{SPACE}") Return 1 EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Add/Remove Hardware Wizard","Welcome to the Add/Remove Hardware Wizard") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Welcome to the Add/Remove Hardware Wizard") Then WinActivate("Add/Remove Hardware Wizard","Welcome to the Add/Remove Hardware Wizard") If WinActive("Add/Remove Hardware Wizard","Welcome to the Add/Remove Hardware Wizard") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Searching for hardware If WinExists("Add/Remove Hardware Wizard","Windows is searching for new Plug and Play hardware") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Windows is searching for new Plug and Play hardware") Then WinActivate("Add/Remove Hardware Wizard","Windows is searching for new Plug and Play hardware") $didsomething = $didsomething + 1 $count = 0 EndIf ; Choose a Hardware Task screen If WinExists("Add/Remove Hardware Wizard","Select the hardware task you want to perform") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Select the hardware task you want to perform") Then WinActivate("Add/Remove Hardware Wizard","Select the hardware task you want to perform") If WinActive("Add/Remove Hardware Wizard","Select the hardware task you want to perform") Then Send("!a") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Choose a Hardware Device If WinExists("Add/Remove Hardware Wizard","The following hardware is already installed on your computer.") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","The following hardware is already installed on your computer.") Then WinActivate("Add/Remove Hardware Wizard","The following hardware is already installed on your computer.") If WinActive("Add/Remove Hardware Wizard","The following hardware is already installed on your computer.") Then Send("{SPACE}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Find New Hardware If WinExists("Add/Remove Hardware Wizard","When Windows detects new hardware") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","When Windows detects new hardware") Then WinActivate("Add/Remove Hardware Wizard","When Windows detects new hardware") If WinActive("Add/Remove Hardware Wizard","When Windows detects new hardware") Then Send("!o") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware Type If WinExists("Add/Remove Hardware Wizard","Select the type of hardware you want to install") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Select the type of hardware you want to install") Then WinActivate("Add/Remove Hardware Wizard","Select the type of hardware you want to install") If WinActive("Add/Remove Hardware Wizard","Select the type of hardware you want to install") Then Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","") If WinActive("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then Send("!d") For $choiceselection = 1 To ($model-1) Step 1 Send ("{DOWN}") Next Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With no white in the middle If WinExists("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","") If WinActive("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add/Remove Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var <> 16777215 Then Send("!h") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Have Disk to Comtrol folder If WinExists("Install From Disk","") Then SplashOff() If Not WinActive("Install From Disk","") Then WinActivate("Install From Disk","") If WinActive("Install From Disk","") Then Send("!c") Send($driverdir) Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Start Hardware Installation If WinExists("Add/Remove Hardware Wizard","Windows will use default settings to install the software") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Windows will use default settings to install the software") Then WinActivate("Add/Remove Hardware Wizard","Windows will use default settings to install the software") If WinActive("Add/Remove Hardware Wizard","Windows will use default settings to install the software") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Digital Signature Not Found If WinExists("Digital Signature Not Found","") Then SplashOff() If Not WinActive("Digital Signature Not Found","") Then WinActivate("Digital Signature Not Found","Digital Signature Not Found") If WinActive("Digital Signature Not Found","") Then Send("!y") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Completed If WinExists("Add/Remove Hardware Wizard","Completing the Add/Remove Hardware Wizard") Then SplashOff() If Not WinActive("Add/Remove Hardware Wizard","Completing the Add/Remove Hardware Wizard") Then WinActivate("Add/Remove Hardware Wizard","Completing the Add/Remove Hardware Wizard") If WinActive("Add/Remove Hardware Wizard","Completing the Add/Remove Hardware Wizard") Then Send("{ENTER}") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Found New Hardware Wizard If WinExists("Found New Hardware Wizard","") Then SplashOff() Exit If Not WinActive("Found New Hardware Wizard","") Then WinActivate("Found New Hardware Wizard","") If WinActive("Found New Hardware Wizard","") Then Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With white in the middle If WinExists("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","") If WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var = 16777215 Then Send("!n") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Select a Device Driver With no white in the middle If WinExists("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then SplashOff() If Not WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then WinActivate("Add Hardware Wizard","") If WinActive("Found New Hardware Wizard","Select the manufacturer and model of your hardware device") Then ; This part makes me sad. The only way I can detect the difference between ; this 'select a driver' window and the previous one is the color at these coordinates ; If I find a better way I will change it. $size = WinGetPos("Add Hardware Wizard","Select the manufacturer and model of your hardware device") $var = PixelGetColor( ($size[0] + 186) , ($size[1] + 246) ) ;$continue = MsgBox(3, "DEBUG", "Color at x:"&($size[0] + 186)&", y:"&($size[1] + 246)&" is "&$var) ;If $continue = -1 OR $continue = 2 OR $continue = 3 Then Exit If $var <> 16777215 Then Send("!h") EndIf EndIf $didsomething = $didsomething + 1 $count = 0 EndIf If WinExists("Found New Hardware Wizard","This wizard will complete the installation for this device") Then SplashOff() If Not WinActive("Found New Hardware Wizard","This wizard will complete the installation for this device") Then WinActivate("Found New Hardware Wizard","This wizard will complete the installation for this device") If WinActive("Found New Hardware Wizard","This wizard will complete the installation for this device") Then ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "Check", "") ControlCommand("Found New Hardware Wizard", "", "Floppy &disk drives", "UnCheck", "") ControlCommand("Found New Hardware Wizard", "", "&CD-ROM drives", "UnCheck", "") ControlCommand("Found New Hardware Wizard", "", "&Specify a location", "UnCheck", "") Send("!n") EndIf $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Add/Remove Hardware Wizard","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Found New Hardware","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; Hardware wizard still open If WinExists("Comtrol NS Link Port","") Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf ; If the hardware wizard process is still running then dont exit If ProcessExists($HWPID) Then SplashOff() $didsomething = $didsomething + 1 $count = 0 EndIf If $didsomething = 0 Then If $count >= 40 Then $done = 1 Else $count = $count + 1 $countdown = int((40 - $count) /4) Sleep(250) EndIf If $splashon Then ControlSetText("Waiting for Hardware Wizard", "", "Static1", "Waiting to be sure hardware wizard is complete... $countdown seconds remain...") Else SplashTextOn("Waiting for Hardware Wizard", "Waiting to be sure hardware wizard is complete... "&$countdown&" seconds remain...", 550, 50) EndIf EndIf $didsomething = 0 WEnd EndFunc Func SearchFiles ($dir, $search, $searchstring) $searchresult = FileFindFirstFile($dir & "\" & $search) $strings = StringSplit($searchstring, ",") $matching = "" If $searchresult = -1 Then Return 0 EndIf While 1 $file = FileFindNextFile($searchresult) If @error Then ExitLoop if $file <> "." AND $file <> ".." Then $filecontents = FileOpen($dir & "\" & $file,0) If $filecontents = -1 Then Return 0 EndIf $searchfile = 1 While 1 AND $searchfile $line = FileReadLine($filecontents) If @error Then ExitLoop For $stringnum = 1 To ($strings[0]) Step 1 $strings[$stringnum] = StringStripWS ( $strings[$stringnum], 3 ) If StringInStr($line, $strings[$stringnum]) Then $matching = $matching & " " & $file $searchfile = 0 ExitLoop EndIf Next Wend FileClose($filecontents) EndIf WEnd FileClose($searchresult) If $matching = "" Then Return 0 EndIf Return 1 EndFunc