1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#NoEnv SendMode Input SetWorkingDir %A_ScriptDir% DllCall("kernel32.dll\SetProcessShutdownParameters", UInt, 0x4FF, UInt, 0) #SingleInstance ignore menu,tray,icon,App\AppInfo\appicon.ico
SetTitleMatchMode, 2
Run, ThunderbirdPortable.exe WinWait, ahk_exe Thunderbird.exe
WinHide, ahk_exe Thunderbird.exe
OnExit, ExitSub
OnMessage(0x404, "AHK_NOTIFYICON") OnMessage(0x11, "WM_QUERYENDSESSION") AHK_NOTIFYICON(wParam, lParam) { if (lParam = 0x202) { WinShow, - Mozilla Thunderbird WinActivate, - Mozilla Thunderbird } } WM_QUERYENDSESSION(wParam, lParam) { ENDSESSION_LOGOFF = 0x80000000 Process,Close,Thunderbird.exe Process,WaitClose,ThunderbirdPortable.exe }
ProcessExist(Name){ Process,Exist,%Name% return Errorlevel }
Loop { If !ProcessExist("thunderbird.exe") { ExitApp } WinGet, winState, MinMax, ahk_exe thunderbird.exe if (winState = -1) { WinHide, - Mozilla Thunderbird } sleep 500 }
ExitSub: WinClose,ahk_exe thunderbird.exe Process,close,Thunderbird.exe ExitApp
|