Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.