Last active
April 20, 2017 07:08
-
-
Save darrenjrobinson/0c7828b98c6831bf31ff01a9e9f16598 to your computer and use it in GitHub Desktop.
Loop looking for a dialog window to accept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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