Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InstallNpcapAutoHotkey.ahk
- ---snip
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- if not A_IsAdmin ;the control clicks dont work without elevation
- {
- Run *RunAs "%A_ScriptFullPath%" ;
- ExitApp
- }
- ;SetTitleMatchMode,RegEx
- if not A_IsAdmin ;the control clicks dont work without elevation
- {
- Run *RunAs "%A_ScriptFullPath%" ;
- ExitApp
- }
- SetControlDelay -1
- BaseFolder := A_ScriptDir "\*.*"
- FileName := "npcap" ;
- Loop, Files, % BaseFolder ;Loop over all files in the Base Folder
- If RegExMatch(A_LoopFileName, "i)^" FileName) ;If the filename begins with the name we set
- Run, % A_LoopFilePath ;Run the file
- WinWait, ahk_class #32770,
- ControlClick, Button2,
- If !WinExist("ahk_class #32770") ;
- return
- WinWait, ahk_class #32770, Installation Options
- Control, Check,, Button6,
- Control, Check,, Button7,
- WinWait, ahk_class #32770,
- ControlClick, Button2,
- WinWait, ahk_class #32770, Installation Complete
- ControlClick, Button2,
- WinWait, ahk_class #32770, Finished
- ControlClick, Button2,
- return
- ---snap
- UninstallNpcapAutoHotkey.ahk
- ---snip
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- ;SetTitleMatchMode,RegEx
- if not A_IsAdmin ;the control clicks dont work without elevation
- {
- Run *RunAs "%A_ScriptFullPath%" ;
- ExitApp
- }
- SetControlDelay -1
- BaseFolder := "C:\Program Files\Npcap\"
- Run, % BaseFolder "Uninstall.exe" ;Run the file
- WinWait, ahk_class #32770,
- ControlClick, Button2,
- Loop{
- Sleep 20
- ControlGet bEnabled, Enabled,, Button2,
- if bEnabled
- {
- ControlClick, Button2,
- break
- }
- }
- return
- ---snap
- tr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement