Thanks for your idea...
I've integrated it into my script... see if you like it now...
This is to solve that annoying problem of outlook not quitting!
Code:
^!z:: ;;Get a list of outlook windows, close outlook if necessary
WinGet, msgWins, List, ahk_class rctrl_renwnd32
If (msgWins > 0) {
i = 1
msgTip =
loop %msgWins% {
cWin := % msgWins%i%
WinGetTitle, winTxt, ahk_id %cWin%
if winTxt =
WinGetText, winTxt, ahk_id %cWin%
msgTip = %msgTip%`n%winTxt%
i++
}
TrayTip, Outlook Windows %i%, %msgTip%, 3, 1
}
Else {
TrayTip, Outlook Windows, No Outlook windows found, 3, 1
}
PROCESS, EXIST, OUTLOOK.EXE
PID := ERRORLEVEL
IF ERRORLEVEL <> 0
{
LOOP, %msgWins%
{
;WinGet, msgWins, List, ahk_class rctrl_renwnd32
WINSHOW, AHK_CLASS rctrl_renwnd32
WINACTIVATE, AHK_CLASS rctrl_renwnd32
WINWAITACTIVE, AHK_PID %PID% AHK_CLASS rctrl_renwnd32,,3
IF ERRORLEVEL
{
WINGETACTIVETITLE, TITLE
WINCLOSE, %TITLE%
}
}
;WINWAIT,, Are you sure you want to permanently delete all the items and subfolders in the "Deleted Items" folder?,3
;CONTROLSEND, , {ENTER}, AHK_CLASS #32770, Are you sure you want to permanently delete all the items and subfolders in the "Deleted Items" folder?
;IF A_INDEX > 30
MsgBox, 4,,Kill Outlook process?
IfMsgBox Yes
PROCESS, CLOSE, OUTLOOK.EXE
;PROCESS, EXIST, OUTLOOK.EXE
;IF ERRORLEVEL = 0
;BREAK
}
return