-
Notifications
You must be signed in to change notification settings - Fork 20
/
MinimizeToTray.au3
446 lines (373 loc) · 17 KB
/
MinimizeToTray.au3
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=MTT.ico
#AutoIt3Wrapper_Outfile=MinimizeToTray.Exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;//Minimize to tray
#include-once
#include <Misc.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include "libs/GUIHotkey.au3"
#include "libs/Json.au3"
#include "cmdline.au3"
Global Const $VERSION = "2.4"
Global Const $CONFIG_INI = "MTTconf.ini"
Global Const $DEFAULT_HIDE_WND_HK = "!{f1}"
Global Const $DEFAULT_RESTORE_LAST_WND_HK = "!{f2}"
Global Const $DEFAULT_RESTORE_ALL_WND_HK = "{f10}"
If CmdlineHasParams() Then
;Cmdline mode does not care about tray and GUI whatsoever.
CmdlineRunCliMode()
Exit
EndIf
Opt('TrayAutoPause', 0)
Opt('TrayMenuMode', 3)
;//$aHiddenWndList = Array that contains handles of all hidden windows.
;//$aTrayItemHandles = Array that contains tray items that indicate names of hidden windows.
;//Elements of these 2 arrays must be perfectly in sync with each other.
Global $aHiddenWndList[0] = [], $aTrayItemHandles[0] = []
Global $hLastWnd ;//Handle of the last window that was hidden
Global $g_hTempParentGUI[48], $g_aTempWindowSize[48][2], $g_nIndex = 0 ;//Method 1 of hiding window
Global $SEMAPHORE = 1
Main()
Func Main()
InitializeConfigs()
InitializeLanguage()
InitializeTray()
InitializeGUIs()
;//Exit if MTT is already running.
If _Singleton("MTT", 1) = 0 Then
TrayTip("MinimizeToTray " & $VERSION, $sTextId_Already_Running, 2)
Sleep(2000)
Exit
EndIf
TrayTip("MinimizeToTray " & $VERSION, $sTextId_Msg_Help_1_Press & " [" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_HideWnd) & "] " & $sTextId_Msg_Help_2_To_Hide_Active & @CRLF _
& $sTextId_Msg_Help_1_Press & " [" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_RestoreLastWnd) & "] " & $sTextId_Msg_Help_3_To_Restore & @CRLF _
& $sTextId_Msg_Help_4_Stored_In_Tray, 5)
RestoreLastShutdownWindows()
;//Main Loop
While 1
HandleTrayEvents()
WEnd
EndFunc
; Read ini config file, set current global hotkeys
Func InitializeConfigs()
Global $sHK_HideWnd = IniRead($CONFIG_INI, "Hotkeys", "HIDE_WINDOW", $DEFAULT_HIDE_WND_HK)
Global $sHK_RestoreLastWnd = IniRead($CONFIG_INI, "Hotkeys", "RESTORE_LAST_WINDOW", $DEFAULT_RESTORE_LAST_WND_HK)
Global $sHK_RestoreAllWnd = IniRead($CONFIG_INI, "Hotkeys", "RESTORE_ALL_WINDOWS", $DEFAULT_RESTORE_ALL_WND_HK)
Global $sRestoreAllWndsOnExit = IniRead($CONFIG_INI, "Extra", "RESTORE_ALL_WINDOWS_ON_EXIT", "False")
Global $sAltF4EndProcess = IniRead($CONFIG_INI, "Extra", "ALT_F4_FORCE_END_PROCESS", "False")
Global $sSaveLegacyWindows = IniRead($CONFIG_INI, "Extra", "SAVE_LEGACY_WINDOWS", "False")
Global $sRestoreFocus = IniRead($CONFIG_INI, "Extra", "RESTORE_FOCUS", "False")
Global $bAltF4EndProcess = TextToBool($sAltF4EndProcess)
Global $bRestoreOnExit = TextToBool($sRestoreAllWndsOnExit)
Global $bSaveLegacyWindows = TextToBool($sSaveLegacyWindows)
Global $bRestoreFocus = TextToBool($sRestoreFocus)
Global $sLanguage = IniRead($CONFIG_INI, "Extra", "LANGUAGE", "en")
HotKeySet($sHK_HideWnd, "HideCurrentWnd")
HotKeySet($sHK_RestoreLastWnd, "RestoreLastWnd")
HotKeySet("!{f4}", "HandleAltF4")
HotKeySet($sHK_RestoreAllWnd, "RestoreAllWnd")
OnAutoItExitRegister("ExitS")
EndFunc
Func InitializeLanguage()
Local $sLanguageFile = FileRead("language_gen\" & $sLanguage & ".json")
Local $hJobj = Json_Decode($sLanguageFile)
Global $sTextId_Already_Running = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Already_Running"]')
Global $sTextId_Tray_Restore_All_Windows = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Restore_All_Windows"]')
Global $sTextId_Tray_Extra = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Extra"]')
Global $sTextId_Tray_Opt_AltF4_Force_Exit_Desc = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Opt_AltF4_Force_Exit_Desc"]')
Global $sTextId_Tray_Opt_Restore_On_Exit_Desc = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Opt_Restore_On_Exit_Desc"]')
Global $sTextId_Tray_Opt_Save_Legacy_Windows_Desc = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Opt_Save_Legacy_Windows_Desc"]')
Global $sTextId_Tray_Opt_Restore_Focus = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Opt_Restore_Focus"]')
Global $sTextId_Tray_Edit_Hotkeys = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Edit_Hotkeys"]')
Global $sTextId_Tray_Quick_Help = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Quick_Help"]')
Global $sTextId_Tray_Exit = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Tray_Exit"]')
Global $sTextId_GUI_Edit_Hotkeys = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Edit_Hotkeys"]')
Global $sTextId_GUI_OK = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_OK"]')
Global $sTextId_GUI_Default = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Default"]')
Global $sTextId_GUI_Hide_Active_Window = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Hide_Active_Window"]')
Global $sTextId_GUI_Restore_Last_Window = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Restore_Last_Window"]')
Global $sTextId_GUI_Restore_All_Windows = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Restore_All_Windows"]')
Global $sTextId_GUI_Warning_Key_Overlap = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Warning_Key_Overlap"]')
Global $sTextId_GUI_Warning_Key_Empty = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Warning_Key_Empty"]')
Global $sTextId_GUI_Language = LoadTextFromLanguageJsonObj($hJobj, '["TextId_GUI_Language"]')
Global $sTextId_Msg_Help_1_Press = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Msg_Help_1_Press"]')
Global $sTextId_Msg_Help_2_To_Hide_Active = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Msg_Help_2_To_Hide_Active"]')
Global $sTextId_Msg_Help_3_To_Restore = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Msg_Help_3_To_Restore"]')
Global $sTextId_Msg_Help_4_Stored_In_Tray = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Msg_Help_4_Stored_In_Tray"]')
Global $sTextId_Msg_Help_5_Elevated_Window_Admin = LoadTextFromLanguageJsonObj($hJobj, '["TextId_Msg_Help_5_Elevated_Window_Admin"]')
EndFunc
Func InitializeTray()
Global $hTrayRestoreAllWnd
Global $hTrayLine1
Global $hTrayEditHotkeys
Global $hTrayOpt
Global $hTrayHelp
Global $hTrayExit
TrayItemDelete($hTrayRestoreAllWnd)
TrayItemDelete($hTrayLine1)
TrayItemDelete($hTrayEditHotkeys)
TrayItemDelete($hTrayOpt)
TrayItemDelete($hTrayHelp)
TrayItemDelete($hTrayExit)
; == Tray Creation Section ==
$hTrayRestoreAllWnd = TrayCreateItem($sTextId_Tray_Restore_All_Windows & " (" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_RestoreAllWnd) & ")")
$hTrayLine1 = TrayCreateItem("") ;//Create a straight line
$hTrayOpt = TrayCreateMenu($sTextId_Tray_Extra)
Global $hTrayAltF4EndProcess = TrayCreateItem($sTextId_Tray_Opt_AltF4_Force_Exit_Desc, $hTrayOpt)
TrayItemSetState($hTrayAltF4EndProcess, $bAltF4EndProcess)
Global $hTrayRestoreOnExit = TrayCreateItem($sTextId_Tray_Opt_Restore_On_Exit_Desc, $hTrayOpt)
TrayItemSetState($hTrayRestoreOnExit, $bRestoreOnExit)
Global $hTraySaveLegacyWindows = TrayCreateItem($sTextId_Tray_Opt_Save_Legacy_Windows_Desc, $hTrayOpt)
TrayItemSetState($hTraySaveLegacyWindows, $bSaveLegacyWindows)
Global $hTrayRestoreFocus = TrayCreateItem($sTextId_Tray_Opt_Restore_Focus, $hTrayOpt)
TrayItemSetState($hTrayRestoreFocus, $bRestoreFocus)
Global $hTrayEditHotkeys = TrayCreateItem($sTextId_Tray_Edit_Hotkeys)
Global $hTrayHelp = TrayCreateItem($sTextId_Tray_Quick_Help)
Global $hTrayExit = TrayCreateItem($sTextId_Tray_Exit)
EndFunc
Func InitializeGUIs()
; == GUI Creation Section ==
Global $hGUIConfigs
GUIDelete($hGUIConfigs)
$hGUIConfigs = GUICreate($sTextId_GUI_Edit_Hotkeys, 300, 300)
Global $hGUIConfigs_Btn_OK = GUICtrlCreateButton($sTextId_GUI_OK, 20, 260, 100, 25)
Global $hGUIConfigs_Btn_Default = GUICtrlCreateButton($sTextId_GUI_Default, 160, 260, 100, 25)
GUICtrlCreateLabel($sTextId_GUI_Hide_Active_Window, 10, 10)
Global $hGUIConfigs_HK_HideWnd = _GUICtrlHotkey_Create($hGUIConfigs, 8, 30)
_GUICtrlHotkey_SetRules($hGUIConfigs_HK_HideWnd, $HKCOMB_NONE, $HOTKEYF_ALT)
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_HideWnd, $sHK_HideWnd)
GUICtrlCreateLabel($sTextId_GUI_Restore_Last_Window, 10, 60)
Global $hGUIConfigs_HK_RestoreLastWnd = _GUICtrlHotkey_Create($hGUIConfigs, 8, 80)
_GUICtrlHotkey_SetRules($hGUIConfigs_HK_RestoreLastWnd, $HKCOMB_NONE, $HOTKEYF_ALT)
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_RestoreLastWnd, $sHK_RestoreLastWnd)
GUICtrlCreateLabel($sTextId_GUI_Restore_All_Windows, 10, 110)
Global $hGUIConfigs_HK_RestoreAllWnd = _GUICtrlHotkey_Create($hGUIConfigs, 8, 130)
_GUICtrlHotkey_SetRules($hGUIConfigs_HK_RestoreAllWnd, $HKCOMB_NONE, $HOTKEYF_ALT)
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_RestoreAllWnd, $sHK_RestoreAllWnd)
GUICtrlCreateLabel($sTextId_GUI_Warning_Key_Overlap, 10, 165, 280, 50)
GUICtrlCreateLabel($sTextId_GUI_Language, 10, 220, 100)
Global $hGUIConfigs_Language = GUICtrlCreateCombo("en", 110, 219, 100, 24)
GUICtrlSetData($hGUIConfigs_Language, "vi|de", $sLanguage) ; Add more options to Language combobox, default to $sLanguage
EndFunc
Func HandleTrayEvents()
$hTrayMsg = TrayGetMsg()
Switch $hTrayMsg
Case $hTrayAltF4EndProcess
ToggleOpt($bAltF4EndProcess, $hTrayAltF4EndProcess)
IniWrite($CONFIG_INI, "Extra", "ALT_F4_FORCE_END_PROCESS", BoolToText($bAltF4EndProcess))
Case $hTrayRestoreOnExit
ToggleOpt($bRestoreOnExit, $hTrayRestoreOnExit)
IniWrite($CONFIG_INI, "Extra", "RESTORE_ALL_WINDOWS_ON_EXIT", BoolToText($bRestoreOnExit))
Case $hTraySaveLegacyWindows
ToggleOpt($bSaveLegacyWindows, $hTraySaveLegacyWindows)
IniWrite($CONFIG_INI, "Extra", "SAVE_LEGACY_WINDOWS", BoolToText($bSaveLegacyWindows))
Case $hTrayRestoreFocus
ToggleOpt($bRestoreFocus, $hTrayRestoreFocus)
IniWrite($CONFIG_INI, "Extra", "RESTORE_FOCUS", BoolToText($bRestoreFocus))
Case $hTrayRestoreAllWnd
RestoreAllWnd()
Case $hTrayExit
ExitS()
Case $hTrayHelp
Help()
Case $hTrayEditHotkeys
EditHotkeys()
EndSwitch
If $SEMAPHORE = 0 Then ; No mutex locks in AutoIt. Pseudo-mutex implementation failed. This is a workaround..
Return
EndIf
For $i = 0 To UBound($aTrayItemHandles) - 1
If $hTrayMsg = $aTrayItemHandles[$i] Then
If $i < UBound($aHiddenWndList) Then
RestoreWnd($aHiddenWndList[$i])
EndIf
ExitLoop
EndIf
Next
EndFunc
Func EditHotkeys()
GUISetState(@SW_SHOW, $hGUIConfigs)
; Temporarily disable current hotkeys
HotKeySet($sHK_HideWnd)
HotKeySet($sHK_RestoreLastWnd)
HotKeySet($sHK_RestoreAllWnd)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $hGUIConfigs_Btn_OK
; Read GUI and save to config file
$sHK_HideWnd = _GUICtrlHotkey_GetHotkey($hGUIConfigs_HK_HideWnd)
$sHK_RestoreLastWnd = _GUICtrlHotkey_GetHotkey($hGUIConfigs_HK_RestoreLastWnd)
$sHK_RestoreAllWnd = _GUICtrlHotkey_GetHotkey($hGUIConfigs_HK_RestoreAllWnd)
; Validate new hotkeys
If $sHK_HideWnd == "" Then
MsgBox(16, "", $sTextId_GUI_Warning_Key_Empty)
ContinueLoop
EndIf
; Save new hotkeys to config ini file
IniWrite($CONFIG_INI, "Hotkeys", "HIDE_WINDOW", $sHK_HideWnd)
IniWrite($CONFIG_INI, "Hotkeys", "RESTORE_LAST_WINDOW", $sHK_RestoreLastWnd)
IniWrite($CONFIG_INI, "Hotkeys", "RESTORE_ALL_WINDOWS", $sHK_RestoreAllWnd)
$sLanguage = GUICtrlRead($hGUIConfigs_Language)
IniWrite($CONFIG_INI, "Extra", "LANGUAGE", $sLanguage)
; Update Tray Text for Restore All Windows
TrayItemSetText($hTrayRestoreAllWnd, $sTextId_GUI_Restore_All_Windows & " (" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_RestoreAllWnd) & ")")
; Reinitialize UI Language
InitializeLanguage()
InitializeTray()
InitializeGUIs()
ExitLoop
Case $hGUIConfigs_Btn_Default
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_HideWnd, $DEFAULT_HIDE_WND_HK)
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_RestoreLastWnd, $DEFAULT_RESTORE_LAST_WND_HK)
_GUICtrlHotkey_SetHotkey($hGUIConfigs_HK_RestoreAllWnd, $DEFAULT_RESTORE_ALL_WND_HK)
EndSwitch
WEnd
; Reenable hotkeys
HotKeySet($sHK_HideWnd, "HideCurrentWnd")
HotKeySet($sHK_RestoreLastWnd, "RestoreLastWnd")
HotKeySet($sHK_RestoreAllWnd, "RestoreAllWnd")
GUISetState(@SW_HIDE, $hGUIConfigs)
EndFunc
Func ToggleOpt(ByRef $bFlag, ByRef $hTrayItem)
$bFlag = Not $bFlag
Local $nTrayItemState = TrayItemGetState($hTrayItem)
If BitAND($nTrayItemState, 1) Then ;//CHECKED
TrayItemSetState($hTrayItem, 4)
ElseIf BitAND($nTrayItemState, 4) Then
TrayItemSetState($hTrayItem, 1)
EndIf
EndFunc ;==>ToggleOpt
Func RestoreLastWnd()
;//Restore window from top of hidden windows stack.
If UBound($aHiddenWndList) Then
RestoreWnd($aHiddenWndList[UBound($aHiddenWndList) - 1])
EndIf
EndFunc ;==>RestoreLastWnd
Func RestoreWnd($hfWnd)
If $SEMAPHORE = 0 Then
Return
EndIf
$SEMAPHORE = 0
Local $nIndex = _ArraySearch($aHiddenWndList, $hfWnd)
WinSetState($hfWnd, "", @SW_SHOW)
If $bRestoreFocus == True Then
WinActivate($hfWnd)
EndIf
If $nIndex >= 0 Then
If $nIndex < UBound($aTrayItemHandles) Then
TrayItemDelete($aTrayItemHandles[$nIndex])
_ArrayDelete($aTrayItemHandles, $nIndex)
EndIf
If $nIndex < UBound($aHiddenWndList) Then
_ArrayDelete($aHiddenWndList, $nIndex)
EndIf
If $bSaveLegacyWindows Then
;//Delete window's name from log file
$sLog = FileRead("MTTlog.txt")
$sLogN = StringReplace($sLog, WinGetTitle($hfWnd), "")
$fd = FileOpen("MTTlog.txt", 2)
FileWrite($fd, $sLogN)
FileClose($fd)
EndIf
EndIf
$SEMAPHORE = 1
EndFunc ;==>RestoreWnd
Func HideWnd($hfWnd)
If $SEMAPHORE = 0 Then
Return
EndIf
$SEMAPHORE = 0
WinSetState($hfWnd, "", @SW_HIDE) ;Traditional WinSetState
_ArrayAdd($aHiddenWndList, $hfWnd)
$hTrayWnd = TrayCreateItem(WinGetTitle($hfWnd), -1, 0) ;, $hTrayMenuShowSelectWnd)
_ArrayAdd($aTrayItemHandles, $hTrayWnd)
$SEMAPHORE = 1
;//Write window's name to log file for legacy restoration in case of unexpected crash.
If $bSaveLegacyWindows Then
FileWrite("MTTlog.txt", WinGetTitle($hfWnd) & @CRLF)
EndIf
$hLastWnd = $hfWnd
EndFunc ;==>HideWnd
Func HideCurrentWnd()
;//Hide currently active window.
HideWnd(WinGetHandle("[ACTIVE]"))
EndFunc ;==>HideCurrentWnd
Func RestoreAllWnd()
;//Show all windows hidden during this session.
Local $aTmp = $aHiddenWndList
For $i = 0 To UBound($aTmp) - 1
RestoreWnd($aTmp[$i])
Next
FileDelete("MTTlog.txt") ;//Lazy way to delete legacy window list in log file.
EndFunc ;==>RestoreAllWnd
Func CloseWnd()
ProcessClose(WinGetProcess(WinGetHandle("[ACTIVE]")))
EndFunc ;==>CloseWnd
Func HandleAltF4()
If $bAltF4EndProcess = True Then
CloseWnd()
Else
HotKeySet("!{f4}")
Send("!{f4}")
HotKeySet("!{f4}", "HandleAltF4")
EndIf
EndFunc ;==>HandleAltF4
Func RestoreLastShutdownWindows()
;//Legacy windows from last run are loaded on startup if available,
;//this should only happen if MTT was unexpectedly closed while some windows were still hidden.
$aPrevWndTitleList = FileReadToArray("MTTlog.txt")
If Not @error Then
For $i = 0 To UBound($aPrevWndTitleList) - 1
If StringLen($aPrevWndTitleList[$i]) >= 1 Then
$hTrayWnd = TrayCreateItem($aPrevWndTitleList[$i] & " - Legacy", -1, 0) ;, $hTrayMenuShowSelectWnd)
_ArrayAdd($aTrayItemHandles, $hTrayWnd)
_ArrayAdd($aHiddenWndList, WinGetHandle($aPrevWndTitleList[$i]))
EndIf
Next
If UBound($aTrayItemHandles) Then
TrayTip("", "You have " & UBound($aTrayItemHandles) & " legacy Window(s) waiting to be restored!", 4)
EndIf
EndIf
EndFunc ;==>RestoreLastShutdownWindows
Func LoadTextFromLanguageJsonObj(ByRef $hJobj, $sKey)
$sValue = Json_Get($hJobj, $sKey)
If $sValue Then
Return $sValue
Else
Return "Language_Load_Error"
EndIf
EndFunc
Func Help()
MsgBox(64, "MinimizeToTray " & $VERSION, $sTextId_Msg_Help_1_Press & " [" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_HideWnd) & "] " & $sTextId_Msg_Help_2_To_Hide_Active & @CRLF _
& $sTextId_Msg_Help_1_Press & " [" & _GuiCtrlHotkey_NameFromAutoItHK($sHK_RestoreLastWnd) & "] " & $sTextId_Msg_Help_3_To_Restore & @CRLF _
& $sTextId_Msg_Help_4_Stored_In_Tray & @CRLF _
& $sTextId_Msg_Help_5_Elevated_Window_Admin & @CRLF & @CRLF _
& "https://github.com/sandwichdoge/MinimizeToTray")
EndFunc ;==>Help
Func ExitS()
If $bRestoreOnExit Then
RestoreAllWnd()
EndIf
Exit
EndFunc ;==>ExitS
Func TextToBool($txt)
If StringLower($txt) == "true" Then
Return True
Else
Return False
EndIf
EndFunc
Func BoolToText($bool)
If $bool Then
Return "True"
Else
Return "False"
EndIf
EndFunc