0%

Thunderbird Portable开机自启动并最小化到系统托盘

问题描述

  1. 便携应用设置为开机启动时会自动打开主界面
  2. Thunderbird 60.0官方并不支持最小化到系统托盘
  3. Thunderbird 第三方最小化到系统托盘的插件如FireTray,最多支持到54.X,在最新版的Thunderbird中并不可用。

可行解决方案:AHK,全称AutoHotkey

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
;=====================================================================
; Thunderbird Portable 60.0+ Tray
; Author:zzz
; date:2018-8-31
; 使用方法:将AHK放在ThunderbirdPortable.exe目录中运行
; 理论上支持所有Thunderbird版本,包括以后发布的版本
;---------------------------------------------------------------------

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
DllCall("kernel32.dll\SetProcessShutdownParameters", UInt, 0x4FF, UInt, 0)
#SingleInstance ignore
menu,tray,icon,App\AppInfo\appicon.ico
;title must contain
SetTitleMatchMode, 2

Run, ThunderbirdPortable.exe
WinWait, ahk_exe Thunderbird.exe
;WinMinimize, 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) ; WM_LBUTTONUP
{
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

欢迎关注我的其它发布渠道