Skip to content

Instantly share code, notes, and snippets.

@bangonkali
Created December 19, 2014 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bangonkali/569ff53c8a2b8119df2d to your computer and use it in GitHub Desktop.
Save bangonkali/569ff53c8a2b8119df2d to your computer and use it in GitHub Desktop.
Waits for Windows Security to open and fills up with password and username.
#include <Debug.au3>
WaitForWindowsSecurity()
Func WaitForWindowsSecurity()
Local $Interval = 20
Local $Interval_Loop = 200
_DebugSetup("Waiting for Windows Security")
_DebugOut("Initiating wait script for Windows Security.")
While True
_DebugOut("Waiting for Windows Security.")
; Wait 10 seconds for the Notepad window to appear.
WinWait("Windows Security")
; Retrieve the handle of the Notepad window using the classname of Notepad.
Local $hWnd = WinGetHandle("Windows Security")
If @error Then
Sleep($Interval_Loop)
_DebugOut("Did not find windows security.")
ExitLoop
Else
_DebugOut("Found windows security.")
Sleep($Interval)
WinSetOnTop($hWnd,"OK", 1)
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "^A")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "{DEL}")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "domain\")
Send("^{TAB}")
Sleep($Interval)
Send("^+{TAB}")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "username")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "^A")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:1]", "{DEL}")
Sleep($Interval)
ControlSend($hWnd,"","[CLASS:Edit; INSTANCE:2]", "password")
Sleep($Interval)
ControlClick($hWnd,"OK","[CLASS:Button; INSTANCE:2]")
EndIf
WEnd
EndFunc ;==>Example1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment