Search the Community
Showing results for tags 'window management'.
-
I'm building a bootable flash drive. I want to include the Wireshark packet watcher. It requres the Npcap service to be running. I'm trying to automate the installation of Npcap after boot. I'm testing in VirtualBox but the same thing happens on physical hardware. In both the "Installing" window and the "Options" window appear AutoIT clicks the appropriate button. When the "Installing" windiow appears, a second or two later the WinWaitActive($Handle,"Completed") fires the ControlClick($WindowTitle"&Next",1) for a button that doesn't exist yet. I sprinkled WinActivate throughout because another program window is on screen while this is happening, but it made no difference. If I close the other program window first it makes no difference. #include <FileConstants.au3> #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> If $CmdLine[0] >= 1 Then $Pause=$CmdLine[1] Else MsgBox(4096,"NPcap installer","Please include the pause flag (False or True) on the command line.") Exit EndIf If $CmdLine[0] >= 2 Then $StartDriver=$CmdLine[2] Else MsgBox(4096,"NPcap installer","Please include the start driver flag (False or True) on the command line.") Exit EndIf $FileList = _FileListToArray(@ScriptDir,"npcap-*.exe",$FLTA_FILES ,True) Select Case @error = 4 MsgBox($MB_OK,"File error","Npcap installer " & @ScriptDir & "\npcap-*.exe not found!") Exit Case @error = 1 MsgBox($MB_OK,"File error","Npcap installer path " & @ScriptDir & " not found!") Exit Case @error=0 EndSelect ; Wait until PE Network Manager settles down. If WinExists("PE Network Manager") Then WinWait("PE Network Manager","Properties",3) $Version = StringRight(StringTrimRight($FileList[1],4),4) $WindowTitle = "Npcap " & $Version & " Setup" ShellExecute($FileList[1]) $WindowTitle = WinWait($WindowTitle,"License Agreement",10) If $WindowTitle <> 0 Then WinActivate($WindowTitle) ControlClick($WindowTitle,"License Agreement",1) WinWaitActive($WindowTitle,"Installation Options") WinActivate($WindowTitle) If $Pause = "False" Then ControlClick($WindowTitle,"&Install",1) EndIf WinActivate($WindowTitle) WinWaitActive($WindowTitle,"Setup was completed") WinActivate($WindowTitle) ; Wait for the "Next" button to be active Sleep(3000) ControlClick($WindowTitle,"&Next",1) WinWaitActive($WindowTitle,"Finished") ControlClick($WindowTitle,"&Finish",1) Else MsgBox($MB_OK,"Npcap install","Did not see the installation window " & $WindowTitle & "!") EndIf If $StartDriver = "True" Then If @OSArch="X86" Then $Command = @WindowsDir & "\SysWOW64\cmd.exe" Else $Command = @SystemDir & "\cmd.exe" EndIf ShellExecute($Command," /c net start npcap") EndIf If you want to wattch it, https://fleming-group.com/Hidden/Video/Video.html. The cmd window flashing is the end of the AutoIT script.