Detect popup, push button (AutoIT 3).
While 1
WinWaitActive("[REGEXPTITLE:(?i)Delete (File|Folder|Multiple Items)]") ; detect Recycle box window
WinWaitActive("[CLASS:#32770]") ; detect Recycle box window (sanity check)
Sleep(500) ; sleep, why not?
; MouseClick("left", 885, 570) ; click on its YES button
ControlClick("[REGEXPTITLE:(?i)Delete (File|Folder|Multiple Items)]", "", "[TEXT:&Yes; ID:6]") ; click on its YES button
Sleep(500) ; sleep, why not?
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1 ; sublime 2 cancel
WinWaitActive("[REGEXPTITLE:(?i)This is an unregistered copy]") ; detect Recycle box window
WinWaitActive("[CLASS:#32770]") ; detect window (sanity check)
Sleep(100) ; sleep, why not?
; MouseClick("left", 885, 570) ; click on its YES button
ControlClick("[REGEXPTITLE:(?i)This is an unregistered copy]", "", "[TEXT:Cancel; ID:2]") ; click on its YES button
Sleep(100) ; sleep, why not?
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;
$title = InputBox("Window", "*Title (regex):", ".*Notepad.*")
$button= InputBox("Window", "Button Text:" & @LF & " - shortcut '&&' supported" & @LF & " - CANCEL ==> {ENTER} key)", "&Yes")
If NOT $button Then
MsgBox(0, "Press Enter", "The ENTER key will be pressed on window detection.")
EndIf
$sleep = InputBox("Window", "*Pause time (ms):", "500")
$sleep = Int($sleep)
While $title AND $sleep; require some $title and $sleep
WinWaitActive("[REGEXPTITLE:(?i)" & $title & "]") ; detect Recycle box window
Sleep($sleep) ; sleep, why not?
If $button Then
; MouseClick("left", 885, 570) ; click on its YES button
ControlClick("[REGEXPTITLE:(?i)Delete (File|Folder|Multiple Items)]", "", "[TEXT:" & $button & "]")
Else
Send('{ENTER}')
EndIf
Sleep($sleep) ; sleep, why not?
WEnd