Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active April 20, 2017 07:08
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 darrenjrobinson/0c7828b98c6831bf31ff01a9e9f16598 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/0c7828b98c6831bf31ff01a9e9f16598 to your computer and use it in GitHub Desktop.
Loop looking for a dialog window to accept
function SendEnter{
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate("Confirm disconnection")
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
start-sleep 1
# Send the Enter Key to the Window
[System.Windows.Forms.SendKeys]::SendWait("~")
}
[int]$i=0
# Give me a chance to start the delete CS Script
start-sleep 15
do {
SendEnter
write-host $i
$i++
} until ($i -eq 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment