Advertisement
publicist

Min2Tray.ahk

Apr 30th, 2016
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;----------------------------------------------------------------------------
  2. ;
  3. ; Min2Tray
  4. ;
  5. versionString = 1.7.7
  6. versionDate   = 20080213
  7. ;
  8. ; _minimize a window to system tray area of taskbar as icon.
  9. ;  BossKey feature for minimizing several windows at once.
  10. ;  make window always-on-top and maximize window vertically
  11. ;  or horizontally. StartupMinimize hides certain windows
  12. ;  upon start of Min2Tray. and much more!
  13. ;
  14. ; _requires ms windows nt/2000/xp or newer.
  15. ;  (not tested under ms vista, yet.)
  16. ;
  17. ; _licensed under the terms of the GPLv3
  18. ;  created by Junyx / KTC^brain in June 2005
  19. ;
  20. ; _program is a 2-in-1 thingy:
  21. ;   _started without parameters on cmdline it behaves as
  22. ;    the main program waiting for hotkey action
  23. ;   _startet with ahk_window_id on cmdline by main program
  24. ;    it will hide that particular window and generate
  25. ;    a (hopefully) meaningful tray icon
  26. ;
  27. ; _inspired by:
  28. ;   ActualWindowMinimizer (unfortunately payware)
  29. ;   NiftyWindows by Enovatic-Solutions (nice tweaks)
  30. ;   ac'tivAid by Heise Zeitschriften Verlag GmbH & Co. KG
  31. ;
  32. ; _contains some code from:
  33. ;   minimize.ahk (from AHK docs, no author)
  34. ;   Icon Viewer Lite v1 by toralf
  35. ;
  36. ; _thanks to:
  37. ;   Chris Mallett (support response in a flash!)
  38. ;   Rajat (for some wonderful scripts)
  39. ;   GSX-R600 / KTC^game (for testing)
  40. ;   Lemmy / KTC^game (for testing)
  41. ;   Demokos and Andreone (French translation)
  42. ;   all users who gave feedback
  43. ;
  44. ;----------------------------------------------------------------------------
  45. ;
  46. ; init
  47. ;
  48. #NoEnv
  49. #MaxMem 1
  50. #Persistent
  51. #NoTrayIcon
  52. #KeyHistory 0
  53. #SingleInstance Off
  54.  
  55. ; language, check-ups etc.
  56. Gosub, h_InitGeneral
  57.  
  58. #UseHook On
  59. #WinActivateForce
  60. StringCaseSense, On
  61. DetectHiddenWindows, On
  62. SetWinDelay 10
  63.  
  64. If ( %0% < 1 )  ; cmdline: no args -> behaviour: starter
  65. {
  66.    ;=========================================================================
  67.    ; started as hotkey-launcher (starter)
  68.     Goto, h_InitStarter
  69.     Return
  70. }
  71. ; end of auto-execution for starter here!
  72. ;============================================================================
  73.  
  74. ;============================================================================
  75. ; function as tray menu for minimized window (helper) starts here
  76.  
  77. ;----------------------------------------------------------------------------
  78. ; Helper -- init
  79. ;
  80. whoami := "helper"
  81. f_SetLanguage( whoami )
  82.  
  83. h_ID0 = 0
  84. Loop, %0%   ; go thru all arguments on command line
  85. {
  86.    tmp := %A_Index%
  87.  
  88.    If InStr( tmp, "0x", TRUE ) = 1
  89.    {  ; get several (at least one) window id
  90.       h_ID0++
  91.       h_ID%h_ID0% = %tmp%
  92.    }
  93.    Else If ( h_ID0 = 0 ) {
  94.       If ( tmp = "__justTriggerAction__")
  95.          h_JTA := TRUE
  96.       Else  ; get title for multi window mode
  97.          h_MultiTitle = %tmp%
  98.    }
  99. }
  100.  
  101. If ( h_ID0 = 0 )
  102.    Goto, h_ExitWithParamError
  103.  
  104. ; h_ID0 now holds the count of window IDs used (1 or more)
  105. ; h_ID1 is the first window ID, h_ID2 the next and so on
  106. newID0 = 0  ; count of true hidden windows
  107. Loop, %h_ID0%
  108. {
  109.    h_WinID := h_ID%A_Index%
  110.    Loop
  111.    {
  112.       skipThis := FALSE
  113.  
  114.       ; set "last used window"
  115.       WinWait, ahk_id %h_WinID%,, 1
  116.       If ( ErrorLevel )
  117.       {  ; It timed out, so go on with next window id
  118.          skipThis := TRUE   ; outer loop skip
  119.         Break
  120.       }
  121.      
  122.       WinGetClass, h_Class
  123.       WinGet, h_Application, ProcessName
  124.    
  125.       ; substitution of "evil class"
  126.       newWinID := f_SubstEvilClass( h_WinID, h_Class, h_Application )
  127.       If ( h_WinID = newWinID )
  128.          ; no substitution: leave the loop!
  129.          Break
  130.       Else
  131.          ; go another looping round with new content in h_WinID...
  132.          h_WinID := newWinID
  133.    }
  134.    If ( skipThis )
  135.       Continue ; skipping since window couldn't be made "last used one"
  136.  
  137.    If f_IsForbiddenWinClass( h_Class )
  138.     Continue
  139.  
  140.    ; get win title for later usage
  141.    WinGetTitle, h_Title
  142.  
  143.    If ( h_JTA )   ; JustTriggerAction (for StartupMinimize) and exit (default)
  144.       retVal := f_TriggerAction( h_WinID, h_Application "|" h_Class "|jta_e", "", h_Title )
  145.       ; retVal will be "m2t" to indicate that minimizing should continue
  146.  
  147.    ; hide the window away if NOT in JustTriggerAction mode
  148.    ; OR if retVal is set to "cont"
  149.    If ( Not h_JTA Or retVal = "m2t" ) {
  150.  
  151.       If ( m2t_NoMinGlobal )
  152.          h_NoMin := TRUE
  153.       Else {
  154.          ; read out app|class|nm for "nominimize"
  155.          h_NoMin := FALSE
  156.          RegRead, h_NoMin, HKCU, %h_RegSubkey%, %h_Application%|nm   ; generic app
  157.         If ( Not h_NoMin )
  158.             RegRead, h_NoMin, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|nm
  159.       }
  160.  
  161.       If ( Not h_NoMin ) {
  162.          ; only minimize window to taskbar prior to hiding if not already done
  163.          WinGet, h_MinMax, MinMax
  164.          If ( h_MinMax <> -1 ) {
  165.             WinMinimize
  166.             Sleep, 75
  167.          }
  168.       }
  169.       Else
  170.          ; give it a sec to breathe
  171.          Sleep, 15
  172.  
  173.       WinHide
  174.       newID0++ ; one more win hidden
  175.       newID%newID0% = %h_WinID%  ; update with substituted or original class
  176.       newApp%newID0% = %h_Application%
  177.       newTit%newID0% = %h_Title%
  178.    }
  179.    Else  ; default: exit after JustTriggerAction
  180.       ExitApp, 0
  181. }
  182.  
  183. If ( newID0 = 0 )
  184.    ExitApp, 1  ; no windows found for hiding
  185.  
  186. ; newID0 now holds the count of window IDs hidden (1 or more)
  187. ; newID1 is the first window ID, newID2 the next and so on
  188. ; newApp1 is the first application name
  189. ; newTit1 is the first window title
  190. ; at least newID1 __must__ be assigned at this point!
  191.  
  192. ; if "h_MultiTitle" is set, user requested a "MultiMode" helper to be started
  193. If ( h_MultiTitle )
  194. {  ; set new vars when in multi mode
  195.    h_Application = __multi__
  196.    h_Title = %h_MultiTitle%
  197.    StringReplace, tmp, h_MultiTitle, %A_SPACE%, , All
  198.    StringReplace, tmp, tmp, %A_TAB%, , All
  199.    StringReplace, tmp, tmp, `r`n, , All
  200.    h_Class = %tmp%
  201.    ; "h_MM" is only TRUE if we are in MultiMode
  202.    h_MM := TRUE
  203. } Else {
  204.    h_MM := FALSE
  205. }
  206.  
  207. ; re-activate last used window after hiding
  208. Sleep, 50
  209. If ( h_NoMin )
  210.    ; use ALT+ESC if last hidden window did NOT use task bar (WinMinimize)
  211.    SendInput, !{ESC}
  212. Else
  213.    WinActivateBottom, A
  214.  
  215. OnExit, h_Unhide
  216. Gosub, h_SetMenu
  217. Gosub, h_SetTray
  218. Gosub, h_SetTimedCheck
  219.  
  220. ; assign user-hotkey, if any
  221. h_hkKey =
  222. RegRead, h_hkKey, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|ch
  223. f_AssignHotkey( h_hkKey, "h_Unhide" )
  224.  
  225. ; set helper-wide variable holding window id or "" if in MultiMode
  226. If ( h_MM )
  227.    h_taID := ""
  228. Else
  229.    h_taID := newID1
  230.  
  231. f_TriggerAction( h_taID, h_Application "|" h_Class "|hide_ea", "", h_MenuWin )
  232.  
  233. Return  ; end of auto execution, wait for menu action
  234.  
  235. ;----------------------------------------------------------------------------
  236. ; Helper -- subs
  237. ;
  238.  
  239. h_TriggerExitApp:
  240.   ; trigger action (if any) before exiting
  241.    OnExit
  242.    f_TriggerAction( h_taID, h_Application "|" h_Class "|exit_eb", "", h_MenuWin )
  243. ExitApp
  244.  
  245. h_Unhide:
  246.   SetTimer, h_CheckForWin, Off
  247.    ; flushes the hotkey buffer before exiting
  248.    ; no more detection of hotkey modifier WIN under windows desktop
  249.    Suspend, On
  250.    f_TriggerAction( h_taID, h_Application "|" h_Class "|unhide_eb", "", h_MenuWin )
  251.    ; memorize currently active window for later (for TA commands)
  252.    ; on "forbidden classes" use last active window then
  253.    If f_IsForbiddenWinClass()
  254.       SendInput, !{ESC}
  255.    h_taActiveWinID := WinActive("A")
  256.    ; start unhiding now
  257.    Loop, %newID0%
  258.    {  ; open windows in reverse order
  259.       tmp := newID0 - (A_Index - 1)
  260.       h_WinID := newID%tmp%
  261.       If ( h_WinID = "" )
  262.          Continue
  263.       WinShow, ahk_id %h_WinID%
  264.       WinRestore, ahk_id %h_WinID%
  265.       WinActivate, ahk_id %h_WinID%
  266.    }
  267.    Gosub, h_TriggerExitApp
  268. Return
  269.  
  270. h_Close:
  271.   Msgbox, 36, %h_MenuWin% - %lng_WindowTitle%, %lng_hClose1%%h_MenuWin%%lng_hClose2%
  272.    IfMsgBox, No ; do not close
  273.       Return
  274.    SetTimer, h_CheckForWin, Off
  275.    Suspend, On
  276.    f_TriggerAction( h_taID, h_Application "|" h_Class "|close_eb", "", h_MenuWin )
  277.    Loop, %newID0%
  278.    {
  279.       h_WinID := newID%A_Index%
  280.       If ( h_WinID = "" )
  281.          Continue
  282.       WinShow, ahk_id %h_WinID%
  283.       WinClose, ahk_id %h_WinID%
  284.    }
  285.    Gosub, h_TriggerExitApp
  286. Return
  287.  
  288. h_SetTimedCheck:
  289.   ; get interval from registry, if any
  290.     RegRead, tmp, HKCU, %h_RegSubkey%\Misc, CheckForWinEveryMiliSec
  291.     If ( ErrorLevel OR tmp < 200 OR tmp > 1000000 )
  292.         tmp = 2500
  293.     SetTimer, h_CheckForWin, %tmp%
  294. Return
  295.  
  296. h_CheckForWin:
  297.   hiddenWin = %newID0%
  298.    Loop, %newID0%
  299.    {
  300.       h_WinID := newID%A_Index%
  301.       ; window already unhidden or non-existing?
  302.       WinGet, tmp, Style, ahk_id %h_WinID%
  303.       Transform, tmp, BitAnd, %tmp%, 0xF0000000
  304.       If ( tmp = 0x10000000 OR tmp = 0x90000000 OR Not WinExist( "ahk_id " h_WinID ) )
  305.       {  ; decrement count of hidden windows
  306.          hiddenWin--
  307.          ; MultiMode: remove entry from sub menu if win ID is still valid
  308.             If ( h_MM AND h_WinID <> "" )
  309.             {
  310.              tmpOld := f_StringLeft( A_Index ": " newTit%A_Index% " [" newApp%A_Index% "]" )
  311.                 Menu, MultiWinMenu, Delete, %tmpOld%
  312.              newID%A_Index% = ; invalidate win ID
  313.             }
  314.       }
  315.         Else
  316.         {
  317.            ; get current title
  318.             WinGetTitle, tmpNew, ahk_id %h_WinID%
  319.          If ( h_MM )
  320.            {  ; we are in MultiMode
  321.             ; check for changed window title
  322.              If ( tmpNew <> newTit%A_Index% )
  323.              {
  324.                 tmpOld := f_StringLeft( A_Index ": " newTit%A_Index% " [" newApp%A_Index% "]" )
  325.                 newTit%A_Index% = %tmpNew%
  326.                 tmp    := f_StringLeft( A_Index ": " newTit%A_Index% " [" newApp%A_Index% "]" )
  327.                 Menu, MultiWinMenu, Rename, %tmpOld%, %tmp%
  328.              }
  329.            }
  330.            Else
  331.            {  ; NOT in MultiMode
  332.             ; check for changed window title
  333.               If ( tmpNew <> h_Title )
  334.               {
  335.                If ( h_sotcEnabled )
  336.                   If ( RegExMatch( tmpNew, h_sotcMatch ) ; show window after
  337.                        Or h_sotcMatch = "" ) ; title changed or RegEx matches
  338.                      Gosub, h_Unhide
  339.                  Else
  340.                  {  ; update window title and redraw menu
  341.                     h_Title = %tmpNew%
  342.                     Gosub, h_SetMenu
  343.                   f_TriggerAction( h_taID, h_Application "|" h_Class "|sotc_ea", "", h_MenuWin )
  344.                  }
  345.               }
  346.            }
  347.         }
  348.    }
  349.    If ( hiddenWin <= 0 )
  350.    {  ; there are no hidden windows anymore
  351.       Gosub, h_TriggerExitApp
  352.    }
  353.  
  354.    ; redraw tray, if changed (for StealthMode)
  355.    f_ShowTrayIcon( h_appExe, h_appExeIcon )
  356. Return
  357.  
  358. h_SetTray:
  359.   h_ciEnabled := FALSE
  360.  
  361.     RegRead, tmp, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|ci ; first look for user icon
  362.     If ( Not ErrorLevel )
  363.     {
  364.         StringSplit, tmparray, tmp, |
  365.         h_appExe     = %tmparray1%
  366.         h_appExeIcon = %tmparray2%
  367.         h_ciEnabled  := TRUE
  368.     }
  369.     Else
  370.     {
  371.         RegRead, tmp, HKCU, %h_RegSubkey%, %h_Application%|ci   ; look for generic user icon (for app)
  372.         If ( Not ErrorLevel )
  373.         {
  374.             StringSplit, tmparray, tmp, |
  375.             h_appExe     = %tmparray1%
  376.             h_appExeIcon = %tmparray2%
  377.         h_ciEnabled  := TRUE
  378.         }
  379.         Else If ( ( h_Application = "explorer.exe" ) AND ( h_Class = "ExploreWClass" ) )
  380.         {   ; special treatment for explorer windows
  381.             h_appExe     = %A_WinDir%\system32\shell32.dll
  382.             h_appExeIcon = 5
  383.         }
  384.         Else
  385.         {   ; use icon from registry-entry as default, if existing
  386.             h_appExeIcon = 1
  387.             RegRead, h_appExe, HKLM, SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\%h_Application%
  388.             If ( h_appExe = "" )
  389.             {   ; otherwise do a file search
  390.                 h_appExe := f_FindFile( h_Application, A_WinDir )
  391.                 If ( h_appExe = "" )    ; nothing found in windir...
  392.                     h_appExe := f_FindFile( h_Application, A_ProgramFiles )
  393.             }
  394.         }
  395.     }
  396.     f_ShowTrayIcon( h_appExe, h_appExeIcon )
  397. Return
  398.  
  399. h_SetMenu:
  400.   h_cnEnabled := FALSE ; custom name in use?
  401.  
  402.     RegRead, h_appName, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|cn   ; look for custom name
  403.     If ( Not ErrorLevel ) {
  404.         h_MenuWin   = %h_appName%
  405.         h_TrayTitle = %h_appName%
  406.         h_cnEnabled := TRUE
  407.     }
  408.     Else {
  409.         RegRead, h_appName, HKCU, %h_RegSubkey%, %h_Application%|cn     ; look for generic custom name
  410.         If ( Not ErrorLevel )
  411.         {
  412.             h_MenuWin   = %h_appName%
  413.             h_TrayTitle = %h_appName%
  414.             h_cnEnabled := TRUE
  415.         }
  416.         Else {
  417.          h_Title    := f_StringLeft( h_Title )
  418.             h_MenuWin   = %h_Title% [%h_Application%]
  419.             h_TrayTitle = %h_Title%`n[%h_Application%]
  420.  
  421.          ; Jaakon's Mode asks for custom name if none is specified
  422.          If ( m2t_JaakonMode ) {
  423.            Gosub, h_ChangeName
  424.            If ( Not ErrorLevel ) {
  425.                ; only set vars if OK was pressed in input box within h_ChangeName
  426.                     h_MenuWin   = %h_appName%
  427.                 h_TrayTitle = %h_appName%
  428.                 h_cnEnabled := TRUE
  429.            }
  430.            m2t_JaakonMode := FALSE
  431.         }
  432.         }
  433.     }
  434.  
  435.    ; ShowOnTitleChange enabled?
  436.    h_sotcEnabled := FALSE
  437.    RegRead, h_sotcMatch, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sotc
  438.    If ( Not ErrorLevel )
  439.       h_sotcEnabled := TRUE
  440.  
  441.    ; NoMinimize enabled?
  442.    RegRead, h_nmEnabled, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|nm
  443.    If ( ErrorLevel )
  444.       h_nmEnabled := FALSE  ; default: nope
  445.  
  446.     Menu, TRAY, DeleteAll   ; tabularasa
  447.     Menu, TRAY, Click, %m2t_clickCount%
  448.     Menu, TRAY, NoStandard
  449.     Menu, TRAY, Add, %h_MenuWin%, h_MenuHandler
  450.  
  451.     ; MultiWin mode
  452.    If ( h_MM ) {
  453.       Loop, %newID0%
  454.       {
  455.          tmp := f_StringLeft( A_Index ": " newTit%A_Index% " [" newApp%A_Index% "]" )
  456.             Menu, MultiWinMenu, Add, %tmp%, h_MenuHandlerMultiWin
  457.       }
  458.       ; possibly ready for left click -> unhide this win
  459.       Menu, TRAY, Add, %lng_MenuMultiWin%, :MultiWinMenu
  460.    }
  461.    Menu, TRAY, Add
  462.  
  463.    ; UserMenu
  464.    umCount := 0  ; count of menu entries
  465.    Loop, 25
  466.    {
  467.       RegRead, umLabel%A_Index%, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|uml%A_Index%
  468.       If ( ErrorLevel Or umLabel%A_Index% = "" )
  469.          Break
  470.       RegRead, umAction%A_Index%, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|uma%A_Index%
  471.       If ( ErrorLevel Or umAction%A_Index% = "" )
  472.          Break
  473.  
  474.       ; increment counter and add menu entry
  475.       umCount++
  476.       Menu, TRAY, Add, % umLabel%A_Index%, h_UserMenuHandler
  477.  
  478.       ; optionally add hotkey
  479.       RegRead, tmp, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|umk%A_Index%
  480.       If ( ( Not ( tmp = "" Or ErrorLevel ) )
  481.              And f_AssignHotkey( tmp, "h_UserMenuHandler" ) )
  482.          umKey%A_Index% := tmp
  483.    }
  484.    If ( umCount > 0 )
  485.       Menu, TRAY, Add
  486.  
  487.    ; "normal" menu
  488.    Menu, TRAY, Add, %lng_MenuPrefs%, h_MenuHandler
  489.    Menu, TRAY, Add
  490.     Menu, TRAY, Add, %lng_MenuClose%, h_MenuHandler
  491.     Menu, TRAY, Add, %lng_MenuUnhide%, h_MenuHandler
  492.     Menu, TRAY, Default, %lng_MenuUnhide%
  493.     Menu, TRAY, Tip, %h_TrayTitle%
  494. Return
  495.  
  496. h_UserMenuHandler:
  497.   If ( umCount <= 0 )
  498.       Return
  499.    If ( h_MM ) ; NO action in multi window mode
  500.       Return
  501.    Loop, %umCount%
  502.    {
  503.       ; fire up the desired TriggerAction
  504.       If ( umLabel%A_Index% = A_ThisMenuItem
  505.            Or ( umKey%A_Index% And umKey%A_Index% = A_ThisHotkey ) ) {
  506.          Sleep, 75
  507.          ; wait for modifier keys to be released,
  508.          ; avoids popping up of windows start menu
  509.          If ( A_ThisHotkey ) {
  510.             KeyWait RWin, T2
  511.             KeyWait LWin, T2
  512.             ;KeyWait Control, T2
  513.             ;KeyWait Alt, T2
  514.             ;KeyWait Shift, T2          
  515.          }
  516.          f_TriggerAction( newID1, h_Application "|" h_Class "|uma" A_Index, "__override__", h_MenuWin )
  517.          Break
  518.       }
  519.    }
  520. Return
  521.  
  522. h_MenuHandler:
  523.   If ( A_ThisMenuItem = lng_MenuUnhide OR A_ThisMenuItem = h_MenuWin )
  524.       Gosub, h_Unhide
  525.  
  526.    ; do not execute a new command while another one is still showing a GUI
  527.    If ( h_noMenuAction OR h_noGUIAction ) {
  528.       SoundPlay, *16
  529.       Return
  530.    }
  531.  
  532.    ; subs creating GUIs, no interference allowed here
  533.    h_noMenuAction := TRUE
  534.  
  535.    If ( A_ThisMenuItem = lng_MenuClose )
  536.       Gosub, h_Close
  537.    If ( A_ThisMenuItem = lng_MenuPrefs )
  538.       Gosub, h_HelperPrefs
  539.  
  540.    h_noMenuAction := FALSE
  541. Return
  542.  
  543. h_MenuHandlerMultiWin:
  544.   ; this routine unhides the selected window
  545.    StringSplit, tmp, A_ThisMenuItem, :%A_Space%, %A_Space%
  546.    h_WinID := newID%tmp1%
  547.    If ( h_WinID = "" )
  548.       Return
  549.    ; unhide this particular window
  550.    WinShow, ahk_id %h_WinID%
  551.    WinRestore, ahk_id %h_WinID%
  552.    WinActivate, ahk_id %h_WinID%
  553.    ; update sub menu
  554.     Menu, MultiWinMenu, Delete, %A_ThisMenuItem%
  555.    ; remove win ID from list
  556.    newID%tmp1% =
  557. Return
  558.  
  559. h_HelperPrefs:
  560.   h_noGUIAction := TRUE
  561.    Suspend, On
  562.  
  563.     ; is this window on BossKey list?
  564.     RegRead, h_bkEnabled, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk ; app+class on bosskey list?
  565.    If ( ErrorLevel )
  566.       h_bkEnabled := FALSE  ; default: nope
  567.  
  568.     ; is this window on startup minimize list?
  569.     RegRead, h_StartupMin, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sm
  570.    If ( ErrorLevel )
  571.       h_StartupMin := FALSE ; default: nope
  572.  
  573.    addWinKey =
  574.    chkWin = 0
  575.    newKey = %h_hkKey%
  576.  
  577.    ; strip off modifier WIN and check the box instead
  578.    If InStr( newKey, "#" ) {
  579.       chkWin = 1
  580.       StringReplace, newKey, newKey, #
  581.    }
  582.      
  583.    Gui, 2:Default
  584.    Gui, +AlwaysOnTop -MinimizeBox -MaximizeBox
  585.  
  586.    ; --- left hand site
  587.    ; hotkey
  588.    Gui, Add, Text, ym, %lng_SetupUnhideKey%:
  589.    Gui, Add, Checkbox, Section y+8 Checked%chkWin% vaddWinKey, WIN +
  590.    Gui, Add, Hotkey, ys yp-4 w180 vnewKey, %newKey%
  591.    ; hint
  592.    Gui, Add, Text, xm w250 R3, %lng_SetupHint%
  593.  
  594.    ; custom icon
  595.    Gui, Add, Checkbox, xm Section Checked%h_ciEnabled% vnewCI, %lng_SetupCustomIcon%
  596.    ; custom name
  597.    Gui, Add, Checkbox, Checked%h_cnEnabled% vnewCN gh_CNtextToggle, %lng_SetupCustomName%:
  598.    Gui, Add, Edit, r1 w240 Limit80 vnewCNtext, %h_MenuWin%
  599.    Gosub, h_CNtextToggle
  600.  
  601.     ; disable some options if in MultiWin mode
  602.     If ( h_MM )
  603.     tmpDis = Disabled
  604.     Else
  605.     tmpDis =
  606.    ; BossKey
  607.    Gui, Add, Checkbox, %tmpDis% Y+14 Checked%h_bkEnabled% vnewBK, %lng_SetupOnBKList%
  608.    ; startup minimize
  609.    Gui, Add, Checkbox, %tmpDis% Checked%h_StartupMin% vnewSM, %lng_SetupOnSMList%
  610.    ; ShowOnTitleChange
  611.    Gui, Add, Checkbox, %tmpDis% Checked%h_sotcEnabled% vnewSOTC gh_SOTCmToggle, %lng_SetupShowOnTitleChange%
  612.    Gui, Add, Text, %tmpDis%, %lng_SetupSOTCRegEx%
  613.    Gui, Add, Edit, %tmpDis% w240 Limit80 vnewSOTCm, %h_sotcMatch%
  614.    Gosub, h_SOTCmToggle
  615.    ; NoMinimize
  616.    Gui, Add, Checkbox, w250 %tmpDis% Checked%h_nmEnabled% vnewNM, %lng_SetupNoMinimize%
  617.    ; events
  618.    Gui, Add, Button, Y+14 w242 gh_2ButtonEvents, %lng_SetupEventTitleH%
  619.  
  620.    ; ok + cancel
  621.    Gui, Add, Button, ym Section w90 gh_2ButtonOK Default, %lng_SetupOK%
  622.    Gui, Add, Button, wp g2BtnCancel, %lng_SetupCancel%
  623.    ; special text to prevent BossKey from working
  624.    Gui, Add, Text, wp Hidden, Min2TrayBKnoHide
  625.  
  626.    Gui, Show, Center, %h_MenuWin% - %lng_SetupTitle%
  627. Return
  628.  
  629. h_CNtextToggle:
  630.   ; enable/disable "custom name" text field according to checkbox state
  631.    GuiControlGet, isChecked, , newCN
  632.    If ( isChecked )
  633.       GuiControl, Enable, newCNtext
  634.    Else
  635.       GuiControl, Disable, newCNtext
  636. Return
  637.  
  638. h_SOTCmToggle:
  639.   ; enable or disable RegEx input field according to checkbox state
  640.    GuiControlGet, isChecked, , newSOTC
  641.    If ( isChecked )
  642.       GuiControl, Enable, newSOTCm
  643.    Else
  644.       GuiControl, Disable, newSOTCm
  645. Return
  646.  
  647. h_2ButtonOK:
  648.   Gui, +OwnDialogs
  649.    Gui, Submit, NoHide
  650.  
  651.    ; unhide key
  652.    h_hkKey := f_ComposeHotkey( newKey, addWinKey, h_hkKey, "h_Unhide", "", h_Application "|" h_Class "|ch", lng_SetupUnhideKey )
  653.    If ( h_hkKey = "__invalid__" )
  654.       Return
  655.  
  656.     ; show-on-title-change
  657.     If ( newSOTC ) {
  658.         h_sotcEnabled := TRUE
  659.         h_sotcMatch := newSOTCm
  660.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sotc, %h_sotcMatch%
  661.     }
  662.     Else {
  663.         h_sotcEnabled := FALSE
  664.         h_sotcMatch =
  665.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sotc
  666.     }
  667.     ; NoMinimize
  668.     If ( newNM ) {
  669.         h_nmEnabled := TRUE
  670.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|nm, %h_nmEnabled%
  671.     }
  672.     Else {
  673.         h_nmEnabled := FALSE
  674.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|nm
  675.     }
  676.     ; remove from/add to bosskey list
  677.     If ( newBK ) {
  678.         h_bkEnabled := TRUE
  679.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk, %h_bkEnabled%
  680.     }
  681.    Else {
  682.         h_bkEnabled := FALSE
  683.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk
  684.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk_wt
  685.     }
  686.     ; remove from/add to startup minimize list
  687.     If ( newSM ) {
  688.         h_StartupMin := TRUE
  689.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sm, %h_StartupMin%
  690.     }
  691.    Else {
  692.         h_StartupMin := FALSE
  693.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sm
  694.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|sm_wt
  695.     }
  696.    ; custom icon
  697.    If ( newCI And !h_ciEnabled )
  698.       Gosub, h_ChangeIcon
  699.    Else If ( !newCI And h_ciEnabled )
  700.       Gosub, h_RemoveIcon
  701.    ; custom name
  702.    If ( newCN And ( !h_cnEnabled Or newCNtext <> h_MenuWin ) ) {
  703.       If ( StrLen( newCNtext ) > 0 ) {
  704.          h_appName := f_StringLeft( newCNtext )
  705.          RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|cn, %h_appName%
  706.          If ( Not m2t_JaakonMode )
  707.             Gosub, h_SetMenu
  708.       }
  709.    }
  710.    Else If ( !newCN And h_cnEnabled ) {
  711.       RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|cn
  712.       If ( Not ErrorLevel ) {
  713.          m2t_JaakonMode := FALSE   ; disable Jaakon's Mode to set script built name
  714.          Gosub, h_SetMenu
  715.       }
  716.    }
  717.    
  718.    Goto, 2GuiClose      
  719. Return
  720.  
  721. 2BtnCancel:
  722. 2GuiEscape:
  723. 2GuiClose:
  724.   Gui, 2:Destroy
  725.    Suspend, Off
  726.    h_noGUIAction := FALSE
  727. Return
  728.  
  729. ; ---------------------------- gui 5 for events -------------------------
  730. h_2ButtonEvents:
  731.   WinGet, lastUsedWin, ID
  732.    Gui, +Disabled
  733.    Gui, 5:Default
  734.    Gui, +Owner2 +ToolWindow
  735.  
  736.    tmpEVreg1 := h_Application "|" h_Class "|hide_ea"
  737.    tmpEVreg2 := h_Application "|" h_Class "|unhide_eb"
  738.    tmpEVreg3 := h_Application "|" h_Class "|close_eb"
  739.    tmpEVreg4 := h_Application "|" h_Class "|exit_eb"
  740.    tmpEVreg5 := h_Application "|" h_Class "|sotc_ea"
  741.    tmpEVreg6 := h_Application "|" h_Class "|jta_e"
  742.  
  743.    ; are we in MultiWin mode
  744.    If ( h_MM )
  745.       countEV = 5 ; yes -> hide JustTriggerAction
  746.    Else
  747.       countEV = 6 ; no -> show all
  748.  
  749.    Loop, %countEV% {
  750.       tmpEVreg = tmpEVreg%A_Index%
  751.       tmpEVlng := lng_SetupEvent%A_Index%
  752.       Gui, Add, Text, w340, %tmpEVlng%:
  753.       Gui, Add, Edit, w330 Limit255 vnewEV%A_Index%, % f_TriggerAction( "", %tmpEVreg%, "", "__readout__")
  754.    }
  755.  
  756.    ; ok + cancel
  757.    Gui, Add, Button, ym Section w90 g5ButtonOK Default, %lng_SetupOK%
  758.    Gui, Add, Button, wp g5BtnCancel, %lng_SetupCancel%
  759.    ; hint
  760.    Gui, Add, Text, xm w440, %lng_SetupEventHint1%
  761.    Gui, Add, Edit, w440 r8 ReadOnly, %lng_SetupEventHint2%
  762.  
  763.    Gui, Show, Center, %h_MenuWin% - %lng_SetupEventTitleH%
  764. Return
  765.  
  766. 5ButtonOK:
  767.   Gui, +OwnDialogs
  768.    Gui, Submit, NoHide
  769.  
  770.    Loop, %countEV% {
  771.       tmpEV = newEV%A_Index%
  772.       If f_TriggerAction( "", %tmpEV%, "__parse__" ) {
  773.          tmpEVreg := tmpEVreg%A_Index%   ; get content of values!
  774.          tmpEV := %tmpEV%
  775.          tmpEV = %tmpEV%   ; auto-trim variable!
  776.          If ( tmpEV = "" )
  777.             RegDelete, HKCU, %h_RegSubkey%, %tmpEVreg%
  778.          Else
  779.             RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %tmpEVreg%, %tmpEV%
  780.       }
  781.       Else {
  782.          tmpEVlng := lng_SetupEvent%A_Index%
  783.          Msgbox, 48, %h_MenuWin% - %lng_SetupEventTitleH%, %lng_SetupEventError%`n"%tmpEVlng%".
  784.          Return
  785.       }
  786.    }  
  787.  
  788.    Goto, 5GuiClose
  789. Return
  790.  
  791. 5BtnCancel:
  792. 5GuiEscape:
  793. 5GuiClose:
  794.   WinActivate, ahk_id %lastUsedWin%
  795.    Gui, 5:Destroy
  796.    Gui, 2:Default
  797.    Gui, -Disabled
  798. Return
  799.  
  800. h_ChangeName:
  801.     SysGet, tmp, 15 ; caption height - for rough computation of dialog height
  802.     tmp *= 7    ; old hardcoded default height was: 125
  803.    InputBox, h_appName, %h_MenuWin% - %lng_WindowTitle%, %lng_ChangeNameSelector%, , , %tmp%, , , , , %h_MenuWin%
  804.    If ( Not ErrorLevel )
  805.    {
  806.       StringLen, tmp, h_appName
  807.       If ( tmp < 1 )
  808.          Return
  809.  
  810.       h_appName := f_StringLeft( h_appName )
  811.       RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|cn, %h_appName%
  812.  
  813.       If ( Not m2t_JaakonMode )
  814.          Gosub, h_SetMenu
  815.    }
  816.    ; ... returns with ErrorLevel still set - needed by h_SetMenu
  817. Return
  818.  
  819. h_ChangeIcon:
  820.   Gui, +OwnDialogs
  821.    Suspend, On
  822.     newIconFile =
  823.    hCIwinTitle = %lng_ChangeIconSelector%%h_MenuWin%" - %lng_WindowTitle%
  824.     hCIcount = 1000
  825.  
  826.   If FileExist( h_appExe )
  827.      tmpFile = %h_appExe%
  828.   Else
  829.      tmpFile = %h_StarterIcon%  ; take default icon location, %A_WinDir%\system32\shell32.dll
  830.   SetTimer, h_ChangeIcon_MoveWin, 1   ; center file selector window upon opening
  831.     FileSelectFile, newIconFile, 1, %tmpFile% , %hCIwinTitle%, %lng_ChangeIconSelectorExt% (*.ico; *.cur; *.ani; *.exe; *.dll; *.cpl; *.scr; *.drv; *.ocx; *.vbx; *.acm; *.bpl)
  832.     If FileExist( newIconFile )
  833.     {
  834.        FileGetAttrib, tmp, %newIconFile%
  835.        If InStr( tmp, "D" )   ; no folders!
  836.           Goto, 3SuspendOff   ; outta here
  837.  
  838.      Gui, 3:Default
  839.      Gui, +AlwaysOnTop -MaximizeBox -MinimizeBox
  840.      Gui, Add, ListView, Section r6 w480 -Multi AltSubmit +Icon gLVevent, IconNumber
  841.      Gui, Add, Button, ys Section w90 Disabled g3BtnOK, %lng_SetupOK%
  842.      Gui, Add, Button, wp g3GuiClose, %lng_SetupCancel%
  843.  
  844.      ;clear list of files
  845.      LV_Delete()
  846.      ;list of images
  847.      imageList := IL_Create(100, 100, 2)
  848.      iLID := LV_SetImageList(imageList)
  849.      If ( iLID )
  850.         IL_Destroy(iLID)
  851.  
  852.      icons = 0
  853.      Loop, 9999
  854.      {
  855.         iconIndex := IL_Add(imageList, newIconFile, A_Index)
  856.         If ( iconIndex > 0 ) {
  857.            icons++
  858.            LV_Add("Icon" . A_Index, icons)
  859.         }
  860.         Else
  861.            Break
  862.      }
  863.  
  864.      userIcon = 0   ; no icon as default
  865.      If ( icons = 1 ) {
  866.         userIcon = 1
  867.         Goto, 3SetIconAndOut
  868.      }
  869.      Else If ( icons = 0 )   ; no icons in file!
  870.         Goto, 3SuspendOff   ; outta here
  871.  
  872.     hCIguiUsed := TRUE
  873.      noDefaultBtn := TRUE
  874.      Gui, Show, Center, %lng_ChangeIconMulti%%h_MenuWin%" - %lng_WindowTitle%
  875.       Goto, 3SuspendOff   ; outta here
  876.  
  877.       LVevent:
  878.         If ( A_GuiControlEvent = "I" ) {
  879.             If ( noDefaultBtn )
  880.             {  ; no icon selected, yet
  881.                GuiControl, Enabled, %lng_SetupOK%
  882.                GuiControl, +Default, %lng_SetupOK%
  883.                noDefaultBtn := FALSE
  884.             }
  885.  
  886.             rowNumber := LV_GetNext()
  887.             If ( rowNumber )
  888.                LV_GetText(userIcon, rowNumber, 1)
  889.             Else {
  890.                userIcon = 0
  891.                GuiControl, Disable, %lng_SetupOK%
  892.                noDefaultBtn := TRUE
  893.             }
  894.          }
  895.  
  896.          If ( A_GuiControlEvent = "DoubleClick" ) {
  897.             If ( noDefaultBtn )  ; no icon selected, yet
  898.                Return
  899.  
  900.             rowNumber := LV_GetNext()
  901.             If ( rowNumber )
  902.                LV_GetText(userIcon, rowNumber, 1)
  903.             Else
  904.                userIcon = 0
  905.  
  906.             Gosub, 3BtnOK
  907.          }
  908.       Return
  909.  
  910.       3BtnOK:
  911.         If ( userIcon = 0 )
  912.             Return
  913.       3SetIconAndOut:
  914.         h_appExe     := newIconFile
  915.          h_appExeIcon := userIcon
  916.          RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|ci, %h_appExe%|%h_appExeIcon%
  917.          Gosub, h_SetTray
  918.       3GuiClose:
  919.      3GuiEscape:
  920.         Gui, 3:Destroy
  921.          hCIguiUsed := FALSE
  922.       3SuspendOff:
  923.         Suspend, Off
  924.       Return   ; mandatory due to nesting!
  925.     }
  926.     Suspend, Off
  927.     Return
  928.  
  929.    h_ChangeIcon_MoveWin:
  930.      IfWinActive, %hCIwinTitle%
  931.       {
  932.          WinGetPos,,, hCIWidth, hCIHeight
  933.         WinMove,,, (A_ScreenWidth/2)-(hCIWidth/2), (A_ScreenHeight/2)-(hCIHeight/2)
  934.         SetTimer, h_ChangeIcon_MoveWin, Off
  935.       }
  936.       Else {
  937.          hCIcount--
  938.          If ( hCIcount = 0 )  ; switch timer always off after "hCIcount" rounds
  939.             SetTimer, h_ChangeIcon_MoveWin, Off
  940.       }
  941.    Return
  942. Return
  943.  
  944. h_RemoveIcon:
  945.   Gui, +OwnDialogs
  946.    RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|ci
  947.    If ( Not ErrorLevel )
  948.       Gosub, h_SetTray
  949. Return
  950.  
  951. ;----------------------------------------------------------------------------
  952. ; Helper error -- subs
  953. ;
  954.  
  955. h_ExitWithParamError:
  956.   f_ShowErrorMsg( lng_ExitWithParamError )
  957. ExitApp, 1
  958.  
  959. ;============================================================================
  960. ; function as launcher for minimizing (starter) starts here
  961.  
  962. ;----------------------------------------------------------------------------
  963. ; Starter -- init
  964. ;
  965.  
  966. h_InitStarter:
  967.   whoami := "starter"
  968.    f_SetLanguage( whoami )
  969.  
  970.    ; lockfile checking
  971.    m2t_lockFileName = %A_Temp%\Min2Tray.lck
  972.    
  973.    IniRead, m2t_chkName, %m2t_lockFileName%, M2Tlock, Name
  974.    IniRead, m2t_chkPID, %m2t_lockFileName%, M2Tlock, PID
  975.    IniRead, m2t_chkDate, %m2t_lockFileName%, M2Tlock, Date
  976.  
  977.    If ( ( m2t_chkName <> "ERROR" ) And ( m2t_chkPID <> "ERROR" ) And ( m2t_chkDate <> "ERROR" ) ) {
  978.       Process, Exist, %m2t_chkPID%          ; PID still existing...
  979.       If ( ErrorLevel ) {
  980.         Process, Exist, %m2t_chkName%       ; and name still existing
  981.         If ( ErrorLevel )
  982.             Goto, ExitWithRunningError  ; error&exit
  983.       }
  984.    }
  985.  
  986.    ; find AutoHotkey.exe and save its path to a variable for later use
  987.    If ( Not A_IsCompiled ) {
  988.       RegRead, h_ahkFullPath, HKLM, SOFTWARE\AutoHotkey, InstallDir
  989.       h_ahkFullPath = %h_ahkFullPath%\AutoHotkey.exe
  990.       IfNotExist, %h_ahkFullPath%
  991.       {
  992.         h_ahkFullPath := f_FindFile( "AutoHotkey.exe", A_ProgramFiles )
  993.         If ( h_ahkFullPath = "" )
  994.          {  ; search windir
  995.             StringSplit, tmparray, A_WinDir, \
  996.             h_ahkFullPath := f_FindFile( "AutoHotkey.exe", tmparray1 )
  997.             If ( h_ahkFullPath = "" )
  998.                 Goto, ExitWithAHKError
  999.         }
  1000.       }
  1001.    }
  1002.  
  1003.    ; number of mouse buttons
  1004.     SysGet, tmp, 43
  1005.    If ( tmp < 3 ) {
  1006.       f_ShowErrorMsg( lng_No3BtnMouseMsg )
  1007.       m2t_noMButton := TRUE
  1008.    }
  1009.    Else
  1010.         m2t_noMButton := FALSE
  1011.  
  1012.    h_helperPIDs :=  ; h_helperPIDs%h_hPIDcount% -- array for PIDs of started helpers
  1013.    h_hPIDcount  := 0
  1014.  
  1015.    Menu, TRAY, NoStandard
  1016.    Menu, TRAY, Add, %lng_MenuAbout%, m2t_MenuHandler
  1017.    Menu, TRAY, Add
  1018.    Menu, TRAY, Add, %lng_MenuBKEditList%, m2t_MenuHandler
  1019.    Menu, TRAY, Add, %lng_MenuSMEditList%, m2t_MenuHandler
  1020.    Menu, TRAY, Add, %lng_MenuPrefs%, m2t_MenuHandler
  1021.    Menu, TRAY, Add
  1022.    Menu, TRAY, Add, %lng_MenuRestoreOnly%, m2t_MenuHandler
  1023.    Menu, TRAY, Add, %lng_MenuQuitRestoreAll%, m2t_MenuHandler
  1024.    Menu, TRAY, Add, %lng_MenuQuitOnly%, m2t_MenuHandler
  1025.    Menu, TRAY, Tip, %lng_TrayTitle%
  1026.  
  1027.    ; --- assigning keys
  1028.    ; key for minimizing
  1029.    m2t_hkKey =
  1030.    RegRead, m2t_hkKey, HKCU, %h_RegSubkey%\Starter, HotkeyMinimize
  1031.    f_AssignHotkey( m2t_hkKey, "h_StartNewHelper" )
  1032.    ; stealthmode key
  1033.    m2t_hkStealth =
  1034.     RegRead, m2t_hkStealth, HKCU, %h_RegSubkey%\Starter, HotkeyStealth
  1035.     If ( ErrorLevel OR m2t_hkStealth = "" )
  1036.        m2t_hkStealth = ^#!PgUp   ; default: Ctrl+Win+Alt+PgUp
  1037.     f_AssignHotkey( m2t_hkStealth, "h_StealthModeToggle" )
  1038.     ; get bosskey mode
  1039.     RegRead, bkMode, HKCU, %h_RegSubkey%\Misc, BossKeyMode
  1040.     If bkMode not in 0,1,2
  1041.        bkMode := 0  ; 0 = Opt-Out, 1 = Opt-In, 2 = Topmost
  1042.    ; bosskey
  1043.    m2t_hkBossKey =
  1044.     RegRead, m2t_hkBossKey, HKCU, %h_RegSubkey%\Starter, HotkeyBossKey
  1045.     f_AssignHotkey( m2t_hkBossKey, "h_BossKey" )
  1046.    ; BossKeyListToggleWin key
  1047.    m2t_hkBKAdd =
  1048.     RegRead, m2t_hkBKAdd, HKCU, %h_RegSubkey%\Starter, HotkeyBossKeyAdd
  1049.     f_AssignHotkey( m2t_hkBKAdd, "h_BossKeyListToggleWin" )
  1050.    ; CTRL+SHIFT+MButton (or user defined) for BossKeyListToggleWin?
  1051.    If ( m2t_noMButton )
  1052.       m2t_BKAddMouse := FALSE
  1053.    Else { ; 3-button-mouse available
  1054.       tmp =
  1055.     RegRead, tmp, HKCU, %h_RegSubkey%\Starter, HotkeyBossKeyAddMouse
  1056.       If f_AssignHotkey( tmp, "h_BossKeyListToggleWin" )
  1057.          m2t_BKAddMouse := TRUE
  1058.       Else
  1059.          m2t_BKAddMouse := FALSE
  1060.    }
  1061.    ; maximizer keys
  1062.    m2t_hkYMax =
  1063.     RegRead, m2t_hkYMax, HKCU, %h_RegSubkey%\Starter, HotkeyYMax
  1064.     f_AssignHotkey( m2t_hkYMax, "h_YMaxWindow" )
  1065.    m2t_hkXMax =
  1066.     RegRead, m2t_hkXMax, HKCU, %h_RegSubkey%\Starter, HotkeyXMax
  1067.     f_AssignHotkey( m2t_hkXMax, "h_XMaxWindow" )
  1068.    ; always-on-top key
  1069.    m2t_hkAOT =
  1070.     RegRead, m2t_hkAOT, HKCU, %h_RegSubkey%\Starter, HotkeyAOT
  1071.     f_AssignHotkey( m2t_hkAOT, "h_AlwaysOnTop" )
  1072.    ; prefs window key
  1073.    m2t_hkPrefs =
  1074.     RegRead, m2t_hkPrefs, HKCU, %h_RegSubkey%\Starter, HotkeyPrefs
  1075.     If ( ErrorLevel OR m2t_hkPrefs = "" )
  1076.        m2t_hkPrefs = ^#!P  ; default: Ctrl+Win+Alt+P
  1077.     f_AssignHotkey( m2t_hkPrefs, "m2t_PrefsKeyHandler" )
  1078.    ; no-buttons key (toggle sys-menu)
  1079.    m2t_hkNoB =
  1080.     RegRead, m2t_hkNoB, HKCU, %h_RegSubkey%\Starter, HotkeyNoButtons
  1081.     f_AssignHotkey( m2t_hkNoB, "h_NoButtons" )
  1082.    ; middle mouse button
  1083.    If ( m2t_noMButton )
  1084.       m2t_hkMButton = 0 ; only 2-button-mouse found
  1085.    Else {
  1086.        RegRead, m2t_hkMButton, HKCU, %h_RegSubkey%\Starter, HotkeyMButton
  1087.        If ( m2t_hkMButton = 1 OR m2t_hkMButton = 2 )
  1088.           f_AssignHotkey( "MButton", "h_StartNewHelper" )
  1089.        Else
  1090.           m2t_hkMButton = 1   ; default: click on title with 3rd button
  1091.    }
  1092.    ; bosskey MultiWin mode
  1093.     RegRead, m2t_BkMultiWin, HKCU, %h_RegSubkey%\Starter, BossKeyMultiWin
  1094.     If ( m2t_BkMultiWin )
  1095.        m2t_BkMultiWin := TRUE
  1096.     Else
  1097.       m2t_BkMultiWin := FALSE
  1098.    ; bosskey to stealth mode
  1099.     RegRead, m2t_Bk2sMode, HKCU, %h_RegSubkey%\Starter, BossKeyToStealth
  1100.     If ( m2t_Bk2sMode )
  1101.        m2t_Bk2sMode := TRUE
  1102.     Else
  1103.       m2t_Bk2sMode := FALSE
  1104.    ; stealth mode current session only
  1105.     RegRead, m2t_SmSessOnly, HKCU, %h_RegSubkey%\Starter, StealthSessionOnly
  1106.     If ( m2t_SmSessOnly OR ErrorLevel )
  1107.        m2t_SmSessOnly := TRUE    ; default: YES
  1108.     Else
  1109.       m2t_SmSessOnly := FALSE
  1110.    Gosub, h_UpdateSessionOnlyState
  1111.    ; forced mode
  1112.     RegRead, m2t_ForcedMode, HKCU, %h_RegSubkey%\Starter, ForcedMode
  1113.     If ( m2t_ForcedMode )
  1114.        m2t_ForcedMode := TRUE
  1115.     Else
  1116.       m2t_ForcedMode := FALSE
  1117.    ; show no error messages mode
  1118.     RegRead, m2t_NoErrorMsgs, HKCU, %h_RegSubkey%\Misc, NoErrorMessages
  1119.     If ( m2t_NoErrorMsgs )
  1120.        m2t_NoErrorMsgs := TRUE
  1121.     Else
  1122.        m2t_NoErrorMsgs := FALSE
  1123.    ; globally enable events
  1124.     RegRead, m2t_EventsEnabled, HKCU, %h_RegSubkey%\Misc, EventsEnabled
  1125.     If ( m2t_EventsEnabled )
  1126.        m2t_EventsEnabled := TRUE
  1127.     Else
  1128.        m2t_EventsEnabled := FALSE
  1129.    ; startup minimizing
  1130.     RegRead, m2t_StartupTimeSpan, HKCU, %h_RegSubkey%\Starter, StartupMinTimeSpan
  1131.     If ( ErrorLevel OR m2t_StartupTimeSpan < 1 OR m2t_StartupTimeSpan > 99999 )
  1132.         m2t_StartupTimeSpan = 25
  1133.     RegRead, m2t_StartupInterval, HKCU, %h_RegSubkey%\Starter, StartupMinInterval
  1134.     If ( ErrorLevel OR m2t_StartupInterval < 200 OR m2t_StartupInterval > 999999 )
  1135.         m2t_StartupInterval = 2500
  1136.     RegRead, m2t_StartupEnabled, HKCU, %h_RegSubkey%\Starter, StartupMinEnabled
  1137.     If ( m2t_StartupEnabled ) {
  1138.        m2t_StartupEnabled := TRUE
  1139.        SetTimer, m2t_StartupMinCheck, %m2t_StartupInterval%
  1140.        SetTimer, m2t_StartupMinOff, %m2t_StartupTimeSpan%000   ; *1000
  1141.     }
  1142.     Else
  1143.       m2t_StartupEnabled := FALSE
  1144.  
  1145.    ; create temporary lockfile
  1146.    m2t_ownPID := DllCall("GetCurrentProcessId")
  1147.    WinGet, m2t_ownName, ProcessName, ahk_pid %m2t_ownPID%
  1148.    
  1149.    IniWrite, %m2t_ownName%, %m2t_lockFileName%, M2Tlock, Name
  1150.    IniWrite, %m2t_ownPID%, %m2t_lockFileName%, M2Tlock, PID
  1151.    IniWrite, %A_Now%, %m2t_lockFileName%, M2Tlock, Date
  1152.  
  1153.     OnExit, h_QuitStarter
  1154.    Gosub, m2t_SetTimedCheck
  1155.    f_ShowTrayIcon( h_StarterIcon, h_StarterIcon# )
  1156.  
  1157.    ; --- modifiy registry settings
  1158.    ; remove orphaned keys
  1159.    RegDelete, HKCU, %h_RegSubkey%\Misc, BossKeyOptIn
  1160. Return
  1161.  
  1162. m2t_SetTimedCheck:
  1163.   ; get interval from registry, if any
  1164.     RegRead, tmp, HKCU, %h_RegSubkey%\Misc, CheckForWinEveryMiliSec
  1165.     If ( ErrorLevel OR tmp < 200 OR tmp > 1000000 )
  1166.         tmp = 2500
  1167.     SetTimer, m2t_CheckForWin, %tmp%
  1168. Return
  1169.  
  1170. m2t_CheckForWin:
  1171.   ; redraw Starter tray, if changed (for StealthMode)
  1172.    f_ShowTrayIcon( h_StarterIcon, h_StarterIcon# )
  1173. Return
  1174.  
  1175. m2t_StartupMinCheck:
  1176.   ; when called scan thru registry entries of windows to be minimized
  1177.    ; (the entries will have "|sm" at the end)
  1178.    ; make use of the f_BossKey() function to do the job right(TM)
  1179.    f_BossKey( "sm" )
  1180. Return
  1181.  
  1182. m2t_StartupMinOff:
  1183.   SetTimer, m2t_StartupMinCheck, Off
  1184.    SetTimer, m2t_StartupMinOff, Off
  1185. Return
  1186.  
  1187. m2t_PrefsKeyHandler:
  1188.   ; this is the jump-in for prefs hotkey
  1189.    tmpMI = %lng_MenuPrefs%
  1190.    ; a bit ugly, but alas...
  1191.    Goto, m2t_MenuHandlerDo
  1192.  
  1193. m2t_MenuHandler:
  1194.   ; this is the jump-in for tray events
  1195.    tmpMI = %A_ThisMenuItem%
  1196.    ; here starts the real work:
  1197. m2t_MenuHandlerDo:
  1198.   If ( tmpMI = lng_MenuRestoreOnly )
  1199.       Gosub, h_RestoreStarter
  1200.  
  1201.    ; do not execute a new command while another one is still showing a GUI
  1202.    If ( m2t_noMenuAction OR m2t_noGUIAction ) {
  1203.       SoundPlay, *16
  1204.       Return
  1205.    }
  1206.  
  1207.    ; subs creating GUIs, no interference allowed here
  1208.    m2t_noMenuAction := TRUE
  1209.    
  1210.    If ( tmpMI = lng_MenuAbout )
  1211.       Gosub, h_AboutStarter
  1212.    If ( tmpMI = lng_MenuBKEditList )
  1213.       Gosub, h_BossKeyPurgeList
  1214.    If ( tmpMI = lng_MenuSMEditList )
  1215.       Gosub, h_StartupMinPurgeList
  1216.    If ( tmpMI = lng_MenuPrefs )
  1217.       Gosub, h_SetHotkeyStarter
  1218.    If ( tmpMI = lng_MenuQuitRestoreAll )
  1219.       Gosub, h_QuitRestoreStarter
  1220.    If ( tmpMI = lng_MenuQuitOnly )
  1221.       Gosub, h_QuitStarter
  1222.  
  1223.    m2t_noMenuAction := FALSE
  1224. Return
  1225.  
  1226. h_StartNewHelper:
  1227.   If ( A_ThisHotkey = m2t_hkKey OR m2t_hkMButton = 2 ) ; what key triggered the action?
  1228.       f_StartNewHelper( "ASAP" )  ; no check for title-click
  1229.    Else
  1230.       f_StartNewHelper( "MOUSE" )
  1231. Return
  1232.  
  1233. h_AboutStarter:
  1234.   Msgbox, 64, %lng_WindowTitle%, %lng_About%
  1235. Return
  1236.  
  1237. h_RestoreStarter:
  1238.     ; close all helpers -> unhide every window
  1239.    Loop
  1240.    {
  1241.       If ( h_hPIDcount = 0 )
  1242.         Break
  1243.       h_process := h_helperPIDs%h_hPIDcount%
  1244.       Process, Exist, %h_process%
  1245.       If ( ErrorLevel )
  1246.       { ; helper still exists
  1247.         WinClose, ahk_pid %h_process%
  1248.       }
  1249.       h_hPIDcount--
  1250.       Sleep, 50
  1251.    }
  1252. Return
  1253.  
  1254. h_QuitRestoreStarter:
  1255.   Gosub, h_RestoreStarter
  1256.    ; ...
  1257. h_QuitStarter:
  1258.   Gosub, h_UpdateSessionOnlyState
  1259.    Gosub, h_CleanUpLockFile
  1260. ExitApp
  1261.  
  1262. h_UpdateSessionOnlyState:
  1263.   If ( m2t_SmSessOnly )
  1264.       f_StealthMode( "OFF" )
  1265. Return
  1266.  
  1267. h_CleanUpLockFile:
  1268.   IfNotExist, %m2t_lockFileName%
  1269.       Return
  1270.    
  1271.    FileDelete, %m2t_lockFileName%
  1272.    If ( ErrorLevel )
  1273.    {
  1274.       FileSetAttrib, -RHS, %m2t_lockFileName%   ; one more try...
  1275.       FileDelete, %m2t_lockFileName%
  1276.       If ( ErrorLevel )
  1277.       { ; fuck it! and exit with code "2"
  1278.          tmp = %lng_ExitWithLockError% "%m2t_lockFileName%".
  1279.          f_ShowErrorMsg( tmp )
  1280.         ExitApp, 2
  1281.       }
  1282.    }
  1283. Return
  1284.  
  1285. h_SetHotkeyStarter:
  1286.   m2t_noGUIAction := TRUE
  1287.    Suspend, On
  1288.  
  1289.    chkWinHK  = 0
  1290.    chkWinBK  = 0
  1291.    chkWinBKA = 0
  1292.    chkWinSK  = 0
  1293.    chkWinAK  = 0
  1294.    chkWinPK  = 0
  1295.    chkWinYK  = 0
  1296.    chkWinXK  = 0
  1297.    chkWinNK  = 0
  1298.    newKey         = %m2t_hkKey%
  1299.    newBossKey     = %m2t_hkBossKey%
  1300.    newBKAdd       = %m2t_hkBKAdd%
  1301.    newStealthKey  = %m2t_hkStealth%
  1302.    newAOTKey      = %m2t_hkAOT%
  1303.    newPrefsKey    = %m2t_hkPrefs%
  1304.    newYMaxKey     = %m2t_hkYMax%
  1305.    newXMaxKey     = %m2t_hkXMax%
  1306.    newNoBKey      = %m2t_hkNoB%
  1307.  
  1308.    ; strip off modifier WIN from hotkey and check the box instead
  1309.    If InStr( newKey, "#" ) {
  1310.       chkWinHK = 1
  1311.       StringReplace, newKey, newKey, #
  1312.    }
  1313.    ; strip off modifier WIN from bosskey and check the box instead
  1314.    If InStr( newBossKey, "#" ) {
  1315.       chkWinBK = 1
  1316.       StringReplace, newBossKey, newBossKey, #
  1317.    }
  1318.    ; strip off modifier WIN from BossKeyListToggle and check the box instead
  1319.    If InStr( newBKAdd, "#" ) {
  1320.       chkWinBKA = 1
  1321.       StringReplace, newBKAdd, newBKAdd, #
  1322.    }
  1323.    ; strip off modifier WIN from stealth-key and check the box instead
  1324.    If InStr( newStealthKey, "#" ) {
  1325.       chkWinSK = 1
  1326.       StringReplace, newStealthKey, newStealthKey, #
  1327.    }
  1328.    ; strip off modifier WIN from AOT-key and check the box instead
  1329.    If InStr( newAOTKey, "#" ) {
  1330.       chkWinAK = 1
  1331.       StringReplace, newAOTKey, newAOTKey, #
  1332.    }
  1333.    ; strip off modifier WIN from Prefs key and check the box instead
  1334.    If InStr( newPrefsKey, "#" ) {
  1335.       chkWinPK = 1
  1336.       StringReplace, newPrefsKey, newPrefsKey, #
  1337.    }
  1338.    ; strip off modifier WIN from Max-keys and check the box instead
  1339.    If InStr( newYMaxKey, "#" ) {
  1340.       chkWinYK = 1
  1341.       StringReplace, newYMaxKey, newYMaxKey, #
  1342.    }
  1343.    If InStr( newXMaxKey, "#" ) {
  1344.       chkWinXK = 1
  1345.       StringReplace, newXMaxKey, newXMaxKey, #
  1346.    }
  1347.    ; strip off modifier WIN from no-buttons key and check the box instead
  1348.    If InStr( newNoBKey, "#" ) {
  1349.       chkWinNK = 1
  1350.       StringReplace, newNoBKey, newNoBKey, #
  1351.    }
  1352.    
  1353.    Gui, +AlwaysOnTop -MinimizeBox -MaximizeBox +LastFound
  1354.    ; --- left hand site
  1355.    ; hint
  1356.    Gui, Add, Text, ym w250 R3 Section, %lng_SetupHint%
  1357.    ; hotkey + mbutton + forcedmode
  1358.    Gui, Add, Text, xs Section, %lng_SetupKey%:
  1359.    Gui, Add, Checkbox, Section y+8 Checked%chkWinHK% vaddWinKeyHK, WIN +
  1360.    Gui, Add, Hotkey, ys yp-4 w180 vnewKey, %newKey%
  1361.    ; bosskey
  1362.    Gui, Add, Text, xs Y+14 Section, %lng_SetupBossKey%:
  1363.    Gui, Add, Checkbox, Section y+8 Checked%chkWinBK% vaddWinKeyBK, WIN +
  1364.    Gui, Add, Hotkey, ys yp-4 w180 vnewBossKey, %newBossKey%
  1365.    ; BossKeyListToggle
  1366.    Gui, Add, Text, xs Y+14 Section, %lng_SetupBKListToggle%:
  1367.    Gui, Add, Checkbox, Section y+8 Checked%chkWinBKA% vaddWinKeyBKA, WIN +
  1368.    Gui, Add, Hotkey, ys yp-4 w180 vnewBKAdd, %newBKAdd%
  1369.    ; stealth-key
  1370.    Gui, Add, Text, xs Y+14 Section, %lng_SetupStealthKey%:
  1371.    Gui, Add, Checkbox, Section y+8 Checked%chkWinSK% vaddWinKeySK, WIN +
  1372.    Gui, Add, Hotkey, ys yp-4 w180 vnewStealthKey, %newStealthKey%
  1373.    ; Max-keys
  1374.    Gui, Add, Text, xs Y+14 Section, %lng_SetupYMaxKey%:
  1375.    Gui, Add, Checkbox, Section y+8 Checked%chkWinYK% vaddWinKeyYK, WIN +
  1376.    Gui, Add, Hotkey, ys yp-4 w180 vnewYMaxKey, %newYMaxKey%
  1377.    Gui, Add, Text, xs Y+14 Section, %lng_SetupXMaxKey%:
  1378.    Gui, Add, Checkbox, Section y+8 Checked%chkWinXK% vaddWinKeyXK, WIN +
  1379.    Gui, Add, Hotkey, ys yp-4 w180 vnewXMaxKey, %newXMaxKey%
  1380.    ; no-buttons key
  1381.    Gui, Add, Text, xs Y+14 Section, %lng_SetupNoBKey%:
  1382.    Gui, Add, Checkbox, Section y+8 Checked%chkWinNK% vaddWinKeyNK, WIN +
  1383.    Gui, Add, Hotkey, ys yp-4 w180 vnewNoBKey, %newNoBKey%
  1384.    ; AOT-key
  1385.    Gui, Add, Text, xs Y+14 Section, %lng_SetupAOTKey%:
  1386.    Gui, Add, Checkbox, Section y+8 Checked%chkWinAK% vaddWinKeyAK, WIN +
  1387.    Gui, Add, Hotkey, ys yp-4 w180 vnewAOTKey, %newAOTKey%
  1388.    ; Show-Prefs-hotkey
  1389.    Gui, Add, Text, xs Y+14 Section, %lng_SetupPrefsKey%:
  1390.    Gui, Add, Checkbox, Section y+8 Checked%chkWinPK% vaddWinKeyPK, WIN +
  1391.    Gui, Add, Hotkey, ys yp-4 w180 vnewPrefsKey, %newPrefsKey%
  1392.    ; startup minimize
  1393.    Gui, Add, Checkbox, xs y+36 Section vnewStartupEnabled Checked%m2t_StartupEnabled%
  1394.    Gui, Add, Button,   ys-18 x+0 w220 gh_ButtonStartup, %lng_SetupStartupEnable%
  1395.    ; --- right hand site
  1396.    If ( m2t_noMButton ) ; disable controls if no 3-button-mouse
  1397.         tmpDis = Disabled
  1398.     Else
  1399.     tmpDis =
  1400.    ; mbutton options
  1401.    tmp0 = 0
  1402.    tmp1 = 0
  1403.    tmp2 = 0
  1404.    tmp%m2t_hkMButton% = 1 ; check the active radiobox
  1405.    Gui, Add, Text, ym Section w250 %tmpDis%, %lng_SetupMButtonTitle%
  1406.    Gui, Add, Radio, w230 vnewMButton0 %tmpDis% Checked%tmp0%, %lng_SetupMButtonOpt0%
  1407.    Gui, Add, Radio, w230 vnewMButton1 %tmpDis% Checked%tmp1%, %lng_SetupMButtonOpt1%
  1408.    Gui, Add, Radio, w230 vnewMButton2 %tmpDis% Checked%tmp2%, %lng_SetupMButtonOpt2%
  1409.    ; bosskey options
  1410.    tmp0 = 0
  1411.    tmp1 = 0
  1412.    tmp2 = 0
  1413.    tmp%bkMode% = 1 ; check the active radiobox
  1414.    Gui, Add, Text, w250 Y+20, %lng_SetupBKTitle%
  1415.    Gui, Add, Radio, w230 vnewBKmode0 Checked%tmp0%, %lng_SetupBKOpt0%
  1416.    Gui, Add, Radio, w230 vnewBKmode1 Checked%tmp1%, %lng_SetupBKOpt1%
  1417.    Gui, Add, Radio, w230 vnewBKmode2 Checked%tmp2%, %lng_SetupBKOpt2%
  1418.    ; on/off options
  1419.    Gui, Add, Checkbox, Section Y+20 w250 vnewBKAddMouse %tmpDis% Checked%m2t_BKAddMouse%, %lng_SetupBKAddMouse%
  1420.    Gui, Add, Checkbox, w250 vnewBkMultiWin Checked%m2t_BkMultiWin%, %lng_SetupBkMultiWin%
  1421.    Gui, Add, Checkbox, w250 vnewBk2sMode Checked%m2t_Bk2sMode%, %lng_SetupBk2sMode%
  1422.    Gui, Add, Checkbox, w250 vnewSmSessOnly Checked%m2t_SmSessOnly%, %lng_SetupStealthSessOnly%
  1423.    Gui, Add, Checkbox, w250 vnewForcedMode Checked%m2t_ForcedMode%, %lng_SetupForcedMode%
  1424.    Gui, Add, Checkbox, w250 vnewNoMinGlobal Checked%m2t_NoMinGlobal%, %lng_SetupNoMinGlobal%
  1425.    Gui, Add, Checkbox, w250 vnewJaakonMode Checked%m2t_JaakonMode%, %lng_SetupJaakonMode%
  1426.    ; set AOT transparency
  1427.    tmp0 := TRUE
  1428.     RegRead, trans, HKCU, %h_RegSubkey%\Starter, TransparentAOT
  1429.    If ( trans < 1 Or trans > 255 ) {
  1430.       trans = 225 ; default to moderate transparency
  1431.       tmp0 := FALSE
  1432.    }
  1433.    Gui, Add, Checkbox, w250 vnewTransChk gh_AOTtransToggle Checked%tmp0%, %lng_SetupAOTSlider1%
  1434.    Gui, Add, Text, xs y+8 w20 vTransText1, %lng_SetupAOTSlider2%
  1435.    Gui, Add, Slider, yp-4 x+5 w128 vnewTransVal Invert Range1-256 Center NoTicks Line1 Page16, %trans%
  1436.    Gui, Add, Text, yp+4 x+5 w20 vTransText2, %lng_SetupAOTSlider3%
  1437.    Gosub, h_AOTtransToggle
  1438.    ; on/off options (cont.)
  1439.    tmp0 := m2t_clickCount - 1
  1440.    Gui, Add, Checkbox, xs w250 vnewClick2Mode Checked%tmp0%, %lng_SetupClick2Mode%
  1441.    Gui, Add, Checkbox, w250 vnewNoErrorMsgs Checked%m2t_NoErrorMsgs%, %lng_SetupNoErrorMsgsMode%
  1442.    Gui, Add, Checkbox, w250 vnewEventsEnabled Checked%m2t_EventsEnabled%, %lng_SetupEventEnable%
  1443.    ; trigger actions for bosskey
  1444.    Gui, Add, Button, y+14 w242 gh_ButtonEvents, %lng_SetupEventTitleBK%
  1445.  
  1446.    ; --- ok + cancel
  1447.    Gui, Add, Button, ym Section w90 gh_ButtonOK Default, %lng_SetupOK%
  1448.    Gui, Add, Button, wp gBtnCancel, %lng_SetupCancel%
  1449.    ; special text to prevent BossKey from working
  1450.    Gui, Add, Text, wp Hidden, Min2TrayBKnoHide
  1451.    
  1452.    Gui, Show, Center, %lng_SetupTitle%
  1453. Return
  1454.  
  1455. h_AOTtransToggle:
  1456.   ; enable/disable transparency slider according to checkbox state
  1457.    GuiControlGet, isChecked, , newTransChk
  1458.    If ( isChecked )
  1459.       action = Enable
  1460.    Else
  1461.       action = Disable
  1462.    GuiControl, %action%, TransText1
  1463.    GuiControl, %action%, TransText2
  1464.    GuiControl, %action%, newTransVal
  1465. Return
  1466.  
  1467. h_ButtonOK:
  1468.   Gui, +OwnDialogs
  1469.    Gui, Submit, NoHide
  1470.  
  1471.    ; hotkey for minimizing
  1472.    m2t_hkKey := f_ComposeHotkey( newKey, addWinKeyHK, m2t_hkKey, "h_StartNewHelper", "Starter", "HotkeyMinimize", lng_SetupKey )
  1473.    If ( m2t_hkKey = "__invalid__" )
  1474.       Return
  1475.  
  1476.    ; hotkey for always-on-top
  1477.    m2t_hkAOT := f_ComposeHotkey( newAOTKey, addWinKeyAK, m2t_hkAOT, "h_AlwaysOnTop", "Starter", "HotkeyAOT", lng_SetupAOTKey )
  1478.    If ( m2t_hkAOT = "__invalid__" )
  1479.       Return
  1480.  
  1481.    ; hotkey for preferences window
  1482.    m2t_hkPrefs := f_ComposeHotkey( newPrefsKey, addWinKeyPK, m2t_hkPrefs, "m2t_PrefsKeyHandler", "Starter", "HotkeyPrefs", lng_SetupPrefsKey )
  1483.    If ( m2t_hkPrefs = "__invalid__" )
  1484.       Return
  1485.  
  1486.    ; hotkeys for maximizing
  1487.    m2t_hkYMax := f_ComposeHotkey( newYMaxKey, addWinKeyYK, m2t_hkYMax, "h_YMaxWindow", "Starter", "HotkeyYMax", lng_SetupYMaxKey )
  1488.    If ( m2t_hkYMax = "__invalid__" )
  1489.       Return
  1490.    m2t_hkXMax := f_ComposeHotkey( newXMaxKey, addWinKeyXK, m2t_hkXMax, "h_XMaxWindow", "Starter", "HotkeyXMax", lng_SetupXMaxKey )
  1491.    If ( m2t_hkXMax = "__invalid__" )
  1492.       Return
  1493.  
  1494.    ; hotkey for no-buttons
  1495.    m2t_hkNoB := f_ComposeHotkey( newNoBKey, addWinKeyNK, m2t_hkNoB, "h_NoButtons", "Starter", "HotkeyNoButtons", lng_SetupNoBKey )
  1496.    If ( m2t_hkNoB = "__invalid__" )
  1497.       Return
  1498.  
  1499.    ; hotkey for stealth mode
  1500.    m2t_hkStealth := f_ComposeHotkey( newStealthKey, addWinKeySK, m2t_hkStealth, "h_StealthModeToggle", "Starter", "HotkeyStealth", lng_SetupStealthKey )
  1501.    If ( m2t_hkStealth = "__invalid__" )
  1502.       Return
  1503.  
  1504.    ; bosskey
  1505.    m2t_hkBossKey := f_ComposeHotkey( newBossKey, addWinKeyBK, m2t_hkBossKey, "h_BossKey", "Starter", "HotkeyBossKey", lng_SetupBossKey )
  1506.    If ( m2t_hkBossKey = "__invalid__" )
  1507.       Return
  1508.  
  1509.    ; BossKeyListToggleWin
  1510.    m2t_hkBKAdd := f_ComposeHotkey( newBKAdd, addWinKeyBKA, m2t_hkBKAdd, "h_BossKeyListToggleWin", "Starter", "HotkeyBossKeyAdd", lng_SetupBKListToggle )
  1511.    If ( m2t_hkBKAdd = "__invalid__" )
  1512.       Return
  1513.  
  1514.    ; bosskey mode
  1515.    If ( newBKmode2 )
  1516.       bkMode := 2   ; topmost
  1517.    Else If ( newBKmode1 )
  1518.       bkMode := 1   ; opt-in
  1519.    Else
  1520.       bkMode := 0   ; default: opt-out
  1521.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, BossKeyMode, %bkMode%
  1522.  
  1523.    ; mbutton mode
  1524.    If ( Not m2t_noMButton )
  1525.     {
  1526.        If ( newMButton1 ) ; title-click
  1527.           m2t_hkMButton := 1
  1528.        Else If ( newMButton2 ) ; just third mouse button
  1529.           m2t_hkMButton := 2
  1530.        Else ; set mbutton-action off
  1531.           m2t_hkMButton := 0
  1532.        If ( m2t_hkMButton = 1 OR m2t_hkMButton = 2 )
  1533.           f_AssignHotkey( "MButton", "h_StartNewHelper" )
  1534.        Else ; set mbutton-action off
  1535.           f_AssignHotkey( "MButton" )
  1536.        RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, HotkeyMButton, %m2t_hkMButton%
  1537.     }
  1538.  
  1539.    ; CTRL+SHIFT+MButton for BossKeyListToggleWin
  1540.    m2t_BKAddMouse := FALSE
  1541.    If ( newBKAddMouse ) {
  1542.       If f_AssignHotkey( "^+MButton", "h_BossKeyListToggleWin" ) {
  1543.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, HotkeyBossKeyAddMouse, ^+MButton
  1544.         m2t_BKAddMouse := TRUE
  1545.       }
  1546.     }
  1547.     Else {
  1548.         f_AssignHotkey( "^+MButton", "" )
  1549.        RegDelete, HKCU, %h_RegSubkey%\Starter, HotkeyBossKeyAddMouse
  1550.    }
  1551.  
  1552.    ; bosskey MultiWin mode
  1553.     If ( newBkMultiWin )
  1554.        m2t_BkMultiWin := TRUE
  1555.     Else
  1556.        m2t_BkMultiWin := FALSE
  1557.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, BossKeyMultiWin, %m2t_BkMultiWin%
  1558.  
  1559.    ; bosskey to stealth mode
  1560.     If ( newBk2sMode )
  1561.        m2t_Bk2sMode := TRUE
  1562.     Else
  1563.        m2t_Bk2sMode := FALSE
  1564.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, BossKeyToStealth, %m2t_Bk2sMode%
  1565.  
  1566.    ; stealth mode is current session only
  1567.     If ( newSmSessOnly )
  1568.        m2t_SmSessOnly := TRUE
  1569.     Else
  1570.        m2t_SmSessOnly := FALSE
  1571.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, StealthSessionOnly, %m2t_SmSessOnly%
  1572.  
  1573.    ; AOT transparency
  1574.    If ( newTransChk And newTransVal < 256 And newTransVal >= 1 )
  1575.       RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, TransparentAOT, %newTransVal%
  1576.    Else
  1577.       RegDelete, HKCU, %h_RegSubkey%\Starter, TransparentAOT
  1578.    
  1579.    ; forced mode
  1580.     If ( newForcedMode )
  1581.        m2t_ForcedMode := TRUE
  1582.     Else
  1583.        m2t_ForcedMode := FALSE
  1584.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, ForcedMode, %m2t_ForcedMode%
  1585.  
  1586.    ; startup minimizing enabled
  1587.     If ( newStartupEnabled )
  1588.        m2t_StartupEnabled := TRUE
  1589.     Else
  1590.        m2t_StartupEnabled := FALSE
  1591.     RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, StartupMinEnabled, %m2t_StartupEnabled%
  1592.  
  1593.    ; NoMinGlobal
  1594.     If ( newNoMinGlobal )
  1595.        m2t_NoMinGlobal := TRUE
  1596.     Else
  1597.        m2t_NoMinGlobal := FALSE
  1598.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, NoMinimize, %m2t_NoMinGlobal%
  1599.  
  1600.    ; Jaakon's mode
  1601.     If ( newJaakonMode )
  1602.        m2t_JaakonMode := TRUE
  1603.     Else
  1604.        m2t_JaakonMode := FALSE
  1605.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, JaakonMode, %m2t_JaakonMode%
  1606.  
  1607.    ; tray menu ClickCount = 2 ?
  1608.     If ( newClick2Mode )
  1609.        m2t_clickCount := 2
  1610.    Else
  1611.        m2t_clickCount := 1
  1612.    RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, ClickCount, %m2t_clickCount%
  1613.  
  1614.    ; show no error messages mode
  1615.     If ( newNoErrorMsgs )
  1616.        m2t_NoErrorMsgs := TRUE
  1617.     Else
  1618.        m2t_NoErrorMsgs := FALSE
  1619.     RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, NoErrorMessages, %m2t_NoErrorMsgs%
  1620.  
  1621.    ; global actions enabled
  1622.     If ( newEventsEnabled )
  1623.        m2t_EventsEnabled := TRUE
  1624.     Else
  1625.        m2t_EventsEnabled := FALSE
  1626.     RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, EventsEnabled, %m2t_EventsEnabled%
  1627.  
  1628.    Goto, GuiClose
  1629. Return
  1630.  
  1631. BtnCancel:
  1632. GuiEscape:
  1633. GuiClose:
  1634.    GUI, 1:Destroy
  1635.    Suspend, Off
  1636.    m2t_noGUIAction := FALSE
  1637. Return
  1638.  
  1639. ; --------------------------- gui 6 for startup -----------------------
  1640. h_ButtonStartup:
  1641.   WinGet, lastUsedWin, ID
  1642.    Gui, +Disabled
  1643.    Gui, 6:Default
  1644.    Gui, +Owner1 +ToolWindow
  1645.  
  1646.    Gui, Add, Text, Section, %lng_SetupStartupTS1%
  1647.    Gui, Add, Text, , %lng_SetupStartupIN1%
  1648.    Gui, Add, Edit, ys w80
  1649.    Gui, Add, UpDown, vnewTimeSpan Range1-99999, %m2t_StartupTimeSpan%
  1650.    Gui, Add, Edit, w80
  1651.    Gui, Add, UpDown, vnewInterval Range200-999999, %m2t_StartupInterval%
  1652.    Gui, Add, Text, ys, %lng_SetupStartupTS2%
  1653.    Gui, Add, Text, , %lng_SetupStartupIN2%
  1654.    Gui, Add, Text, xm, %lng_SetupStartupHint%
  1655.  
  1656.    ; --- ok + cancel
  1657.    Gui, Add, Button, ym Section w90 g6ButtonOK Default, %lng_SetupOK%
  1658.    Gui, Add, Button, wp g6BtnCancel, %lng_SetupCancel%
  1659.  
  1660.    Gui, Show, Center, %lng_WindowTitle% - %lng_SetupStartupTitle%
  1661. Return
  1662.  
  1663. 6ButtonOK:
  1664.   Gui, +OwnDialogs
  1665.    Gui, Submit, NoHide
  1666.  
  1667.    ; no range checking needed because updown control did it already!
  1668.    m2t_StartupTimeSpan = %newTimeSpan%
  1669.     RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, StartupMinTimeSpan, %m2t_StartupTimeSpan%
  1670.    m2t_StartupInterval = %newInterval%
  1671.     RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, StartupMinInterval, %m2t_StartupInterval%
  1672.  
  1673.    Goto, 6GuiClose
  1674. Return
  1675.  
  1676. 6BtnCancel:
  1677. 6GuiEscape:
  1678. 6GuiClose:
  1679.   WinActivate, ahk_id %lastUsedWin%
  1680.    Gui, 6:Destroy
  1681.    Gui, 1:Default
  1682.    Gui, -Disabled
  1683. Return
  1684.  
  1685. ; ---------------------------- gui 7 for events -------------------------
  1686. h_ButtonEvents:
  1687.   WinGet, lastUsedWin, ID
  1688.    Gui, +Disabled
  1689.    Gui, 7:Default
  1690.    Gui, +Owner1 +ToolWindow
  1691.  
  1692.    tmpEVreg1 = BossKeyEventBefore
  1693.    tmpEVreg2 = BossKeyEventAfter
  1694.  
  1695.    Loop, 2 {
  1696.       tmpEVreg = tmpEVreg%A_Index%
  1697.       tmpEVlng := lng_SetupEventBK%A_Index%
  1698.       Gui, Add, Text, w340, %tmpEVlng%:
  1699.       Gui, Add, Edit, r1 w330 Limit255 vnewEV%A_Index%, % f_TriggerAction( "", %tmpEVreg%, h_RegSubkey "\Starter", "__readout__")
  1700.    }
  1701.  
  1702.    ; --- ok + cancel
  1703.    Gui, Add, Button, ym Section w90 g7ButtonOK Default, %lng_SetupOK%
  1704.    Gui, Add, Button, wp g7BtnCancel, %lng_SetupCancel%
  1705.    ; hint
  1706.    Gui, Add, Text, xm w440, %lng_SetupEventHint1%
  1707.    Gui, Add, Edit, w440 r8 ReadOnly, %lng_SetupEventHint2%
  1708.  
  1709.    Gui, Show, Center, %lng_WindowTitle% - %lng_SetupEventTitleBK%
  1710. Return
  1711.  
  1712. 7ButtonOK:
  1713.   Gui, +OwnDialogs
  1714.    Gui, Submit, NoHide
  1715.  
  1716.    Loop, 2 {
  1717.       tmpEV = newEV%A_Index%
  1718.       If f_TriggerAction( "", %tmpEV%, "__parse__" ) {
  1719.          tmpEVreg := tmpEVreg%A_Index%   ; get content of values!
  1720.          tmpEV := %tmpEV%
  1721.          tmpEV = %tmpEV%   ; auto-trim variable!
  1722.          If ( tmpEV = "" )
  1723.             RegDelete, HKCU, %h_RegSubkey%\Starter, %tmpEVreg%
  1724.          Else
  1725.             RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Starter, %tmpEVreg%, %tmpEV%
  1726.       }
  1727.       Else {
  1728.          tmpEVlng := lng_SetupEventBK%A_Index%
  1729.          Msgbox, 48, %lng_WindowTitle% - %lng_SetupEventTitleBK%, %lng_SetupEventError%`n"%tmpEVlng%".
  1730.          Return
  1731.       }
  1732.    }  
  1733.  
  1734.    Goto, 7GuiClose
  1735. Return
  1736.  
  1737. 7BtnCancel:
  1738. 7GuiEscape:
  1739. 7GuiClose:
  1740.   WinActivate, ahk_id %lastUsedWin%
  1741.    Gui, 7:Destroy
  1742.    Gui, 1:Default
  1743.    Gui, -Disabled
  1744. Return
  1745.  
  1746. h_BossKey:
  1747.   f_TriggerAction( "", "BossKeyEventBefore", h_RegSubkey "\Starter" )
  1748.    If ( m2t_Bk2sMode )
  1749.    {  ; enforce StealthMode
  1750.       f_StealthMode( "ON" )
  1751.     f_ShowTrayIcon( h_StarterIcon, h_StarterIcon# )
  1752.    }
  1753.    success := f_BossKey()
  1754.    If ( success )
  1755.       f_TriggerAction( "", "BossKeyEventAfter", h_RegSubkey "\Starter" )
  1756. Return
  1757.  
  1758. h_BossKeyListToggleWin: ; *erm* the names don't get any better :-|
  1759.    f_BossKeyListToggleWin()
  1760. Return
  1761.  
  1762. h_BossKeyPurgeList:
  1763.   plPre = bk
  1764.    lng_PurgeList = %lng_BKPurgeList%
  1765.    lng_PurgeListTitle = %lng_BKPurgeListTitle%
  1766.    lng_PurgeListReq = %lng_BKPurgeListReq%
  1767.    Gosub, h_PurgeList
  1768. Return
  1769.  
  1770. h_StartupMinPurgeList:
  1771.   plPre = sm
  1772.    lng_PurgeList = %lng_SMPurgeList%
  1773.    lng_PurgeListTitle = %lng_SMPurgeListTitle%
  1774.    lng_PurgeListReq = %lng_SMPurgeListReq%
  1775.    Gosub, h_PurgeList
  1776. Return
  1777.  
  1778. ; ---------------------------- gui 4 for PurgeList -------------------------
  1779. h_PurgeList:
  1780.   ; this subroutine requires
  1781.    ; plPre, lng_PurgeList, lng_PurgeListTitle, lng_PurgeListReq
  1782.    ; to be assigned beforehand
  1783.    m2t_noGUIAction := TRUE
  1784.    Suspend, On
  1785.    ; setup listview
  1786.    Gui, 4:Default
  1787.    Gui, +AlwaysOnTop -MinimizeBox -MaximizeBox
  1788.    Gui, Add, Text, w520, %lng_PurgeList%:
  1789.    Gui, Add, ListView, r15 wp+20 Count30 -Multi Grid ReadOnly AltSubmit gPurgeListView vPurgeListView, RegName|Application|Class|Window title or ID
  1790.    ; add entries to listview
  1791.    Loop, HKCU, %h_RegSubkey%
  1792.    {
  1793.       StringSplit, tmp, A_LoopRegName, |
  1794.     If ( tmp0 = 3 AND tmp3 = plPre ) {
  1795.          tmpApp = %tmp1%
  1796.          tmpClass = %tmp2%
  1797.       }
  1798.     Else If ( tmp0 = 2 AND tmp2 = plPre ) {
  1799.          tmpApp = %tmp1%
  1800.          tmpClass = <ANY>
  1801.       }
  1802.     Else
  1803.          Continue
  1804.    
  1805.       wtList =
  1806.       RegRead, wtList, HKCU, %h_RegSubkey%, %A_LoopRegName%_wt
  1807.       If ( wtList = "" )
  1808.          wtList = <ANY>
  1809.    
  1810.       LV_Add( "", A_LoopRegName, tmpApp, tmpClass, wtList )
  1811.    }
  1812.    LV_ModifyCol( )      ; auto size
  1813.    LV_ModifyCol( 1, 0 ) ; col#1 is invisible
  1814.    ; buttons  
  1815.    disabledBtns := TRUE ; initially the buttons are disabled
  1816.    Gui, Add, Button, Disabled ys Section w90 g4BtnEdit Default, %lng_SetupEdit%
  1817.    Gui, Add, Button, Disabled wp g4BtnRemove, %lng_SetupRemove%
  1818.    Gui, Add, Button, wp g4GuiClose, %lng_SetupClose%
  1819.    Gui, Show, Center, %lng_PurgeListTitle%
  1820. Return
  1821.  
  1822. PurgeListView:
  1823.   If ( A_GuiControlEvent = "I" ) {
  1824.       ; enable buttons if row is selected
  1825.       If ( disabledBtns ) {
  1826.          GuiControl, Enabled, %lng_SetupEdit%
  1827.          GuiControl, Enabled, %lng_SetupRemove%
  1828.          disabledBtns := FALSE
  1829.       }
  1830.       ; re-disable buttons if no row is selected  
  1831.       rowNumber := LV_GetNext()
  1832.       If ( Not rowNumber ) {
  1833.          GuiControl, Disabled, %lng_SetupEdit%
  1834.          GuiControl, Disabled, %lng_SetupRemove%
  1835.          disabledBtns := TRUE
  1836.       }
  1837.    }
  1838.    ; double clicking = edit
  1839.    If ( A_GuiControlEvent = "DoubleClick" ) {
  1840.       If ( disabledBtns )
  1841.          Return
  1842.       Gosub, 4BtnEdit
  1843.    }
  1844. Return
  1845.  
  1846. 4BtnRemove:
  1847.   Gui, +OwnDialogs
  1848.    ; get row# and regName
  1849.    rowNumber := LV_GetNext()
  1850.    If ( rowNumber ) {
  1851.       LV_GetText( regName, rowNumber, 1 )
  1852.       LV_GetText( tmpApp, rowNumber, 2 )
  1853.       LV_GetText( tmpClass, rowNumber, 3 )
  1854.       LV_GetText( tmpWTlist, rowNumber, 4 )
  1855.    }
  1856.    Else
  1857.       Return
  1858.    ; ask user
  1859.    Msgbox, 36, %lng_PurgeListTitle%, %tmpApp% | %tmpClass% | %tmpWTlist%`n`n%lng_PurgeListReq%
  1860.       IfMsgBox, No
  1861.          Return
  1862.    ; do the dirty work
  1863.    LV_Delete( rowNumber )
  1864.    RegDelete, HKCU, %h_RegSubkey%, %regName%
  1865.    RegDelete, HKCU, %h_RegSubkey%, %regName%_wt
  1866. Return
  1867.  
  1868. 4GuiEscape:
  1869. 4GuiClose:
  1870.   GUI, 4:Destroy
  1871.    Suspend, Off
  1872.    m2t_noGUIAction := FALSE
  1873. Return
  1874.  
  1875. ; ------------------------ gui 8 for PurgeList edit window ---------------------
  1876. 4BtnEdit:
  1877.   Gui, +OwnDialogs
  1878.    ; get row# and regName
  1879.    rowNumber := LV_GetNext()
  1880.    If ( rowNumber )
  1881.       LV_GetText( regName, rowNumber, 1 )
  1882.    Else
  1883.       Return
  1884.    ; spawn edit window
  1885.    WinGet, lastUsedWin, ID
  1886.    Gui, +Disabled
  1887.    Gui, 8:Default
  1888.    Gui, +Owner4 +ToolWindow
  1889.    ; split reg-key data
  1890.    StringSplit, tmp, regName, |
  1891.    If ( tmp0 = 3 AND tmp3 = plPre ) {
  1892.       data1 = %tmp1%
  1893.       data2 = %tmp2%
  1894.    }
  1895.    Else If ( tmp0 = 2 AND tmp2 = plPre ) {
  1896.       data1 = %tmp1%
  1897.       data2 =        ; no class!
  1898.    }
  1899.    Else {
  1900.       Gosub, 8GuiClose
  1901.       Return
  1902.    }
  1903.    RegRead, data3, HKCU, %h_RegSubkey%, %regName%_wt
  1904.    ; buttons
  1905.    Gui, Add, Text, w320, Application
  1906.    Gui, Add, Edit, r1 w300 Limit255 Disabled vnewData1, %data1%
  1907.    Gui, Add, Text, w320, Class
  1908.    Gui, Add, Edit, r1 w300 Limit255 vnewData2, %data2%
  1909.    Gui, Add, Text, w320, Window title or ID
  1910.    Gui, Add, Edit, r1 w300 Limit255 vnewData3, %data3%
  1911.    ; --- ok + cancel
  1912.    Gui, Add, Button, ym Section w90 g8ButtonOK Default, %lng_SetupOK%
  1913.    Gui, Add, Button, wp g8BtnCancel, %lng_SetupCancel%
  1914.    Gui, Add, Text, xm w400, %lng_PurgeListHint%
  1915.    Gui, Show, Center, %lng_WindowTitle% - %lng_PurgeListTitle%
  1916. Return
  1917.  
  1918. 8ButtonOK:
  1919.   Gui, +OwnDialogs
  1920.    Gui, Submit, NoHide
  1921.    ; at least the application name is needed!
  1922.    If ( newData1 = "" )
  1923.       Return
  1924.    ; remove old keys
  1925.    newRegName = %regName%
  1926.    RegDelete, HKCU, %h_RegSubkey%, %newRegName%
  1927.    RegDelete, HKCU, %h_RegSubkey%, %newRegName%_wt
  1928.    ; set new reg-key
  1929.    If ( newData2 = "" )
  1930.    {  ; generic, without "class"
  1931.       newRegName = %newData1%|%plPre%
  1932.       RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %newRegName%, 1
  1933.    }
  1934.    Else
  1935.    {  ; with "class"
  1936.       newRegName = %newData1%|%newData2%|%plPre%
  1937.       RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %newRegName%, 1
  1938.    }
  1939.    ; also use window list?
  1940.    If ( newData3 <> "" ) {
  1941.       RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %newRegName%_wt, %newData3%
  1942.    }
  1943.    ; do the dirty work
  1944.    Gosub, 8GuiClose
  1945.    ; operate on GUI4!
  1946.    If ( newData2 = "" )
  1947.       newData2 = <ANY>
  1948.    If ( newData3 = "" )
  1949.       newData3 = <ANY>
  1950.    LV_Modify( rowNumber, "", newRegName, newData1, newData2, newData3 )
  1951.    LV_ModifyCol( 3 )  ; auto size
  1952.    LV_ModifyCol( 4 )
  1953. Return
  1954.  
  1955. 8BtnCancel:
  1956. 8GuiEscape:
  1957. 8GuiClose:
  1958.   WinActivate, ahk_id %lastUsedWin%
  1959.    Gui, 8:Destroy
  1960.    Gui, 4:Default
  1961.    Gui, -Disabled
  1962. Return
  1963.  
  1964. h_StealthModeToggle:
  1965.   ; toggle stealth
  1966.    f_StealthMode()
  1967.     ; update/remove icon for Starter
  1968.     f_ShowTrayIcon( h_StarterIcon, h_StarterIcon# )
  1969. Return
  1970.  
  1971. h_YMaxWindow:
  1972.     f_MaxWindow( "", "Y" )
  1973. Return
  1974.  
  1975. h_XMaxWindow:
  1976.     f_MaxWindow( "", "X" )
  1977. Return
  1978.  
  1979. h_AlwaysOnTop:
  1980.   f_AlwaysOnTop()
  1981. Return
  1982.  
  1983. h_NoButtons:
  1984.   f_NoButtons()
  1985. Return
  1986.  
  1987. ;-----------------------------------------------------------------------------
  1988. ; Starter functions
  1989. ;
  1990.  
  1991. f_BossKey( bkPre="" )
  1992. {  ; hide all visible windows with one keystroke
  1993.    ; returns TRUE if windows to be hidden were found
  1994.    Global bkMode, h_RegSubkey, m2t_hkBossKey, m2t_BkMultiWin, m2t_NoMinGlobal
  1995.    Static m2t_smList
  1996.  
  1997.    If ( Not bkPre )
  1998.       bkPre = bk  ; set a default
  1999.  
  2000.    ; set special values for SM mode
  2001.    If ( bkPre="sm" ) {
  2002.       fbkMode  := 1     ; 1 = opt-in mode
  2003.       multiWin := FALSE ; "StartupMinimize" hides to seperate icons
  2004.       smMode   := TRUE  ; this is just a flag: we are in SM mode right now
  2005.    }
  2006.    Else {
  2007.       fbkMode  := bkMode
  2008.       multiWin := m2t_BkMultiWin
  2009.       smMode   := FALSE
  2010.    }
  2011.  
  2012.     ; build list with currently active (visible) windows
  2013.     DetectHiddenWindows, Off
  2014.     WinGet, bkWinID, List
  2015.     DetectHiddenWindows, On
  2016.     If ( bkWinID = 0 )  ; no windows to hide
  2017.        Return FALSE
  2018.  
  2019.     ; in topmost mode:
  2020.    ; get frontmost window's unique id
  2021.     If ( fbkMode = 2 ) {
  2022.       ; on "forbidden classes" use last active window then
  2023.       If f_IsForbiddenWinClass()
  2024.          SendInput, !{ESC}
  2025.     tmID := WinActive("A")
  2026.       tmID := f_SubstEvilClass( tmID )
  2027.    }
  2028.  
  2029.     ; go thru list and hide all windows, except those that are opt'ed-out by user
  2030.     ; bkHideID holds the count of windows to hide, bkHideID1 is the first...
  2031.     bkHideID = 0
  2032.     Loop, %bkWinID%
  2033.     {
  2034.         tmpWinID := bkWinID%A_Index%
  2035.         WinGetClass, bkClass, ahk_id %tmpWinID%
  2036.     ; skip these classes
  2037.         If f_IsForbiddenWinClass( bkClass, "TfPSPad,SysShadow,ThunderRT6Main" )  ;,BaseBar
  2038.            Continue
  2039.       ; do not minimize windows with a text of "Min2TrayBKdisable" in GUI,
  2040.       ; prevents BossKey to hide the prefs window of BK-helper
  2041.       If ( bkClass = "AutoHotkeyGUI" ) {
  2042.          WinGetText, wText, ahk_id %tmpWinID%
  2043.          If InStr( wText, "Min2TrayBKnoHide", TRUE )
  2044.             Continue
  2045.       }
  2046.  
  2047.       bkEnabled := FALSE
  2048.         WinGet, bkApplication, ProcessName, ahk_id %tmpWinID%
  2049.         subKey = %bkApplication%|%bkClass%  ; app+class
  2050.         RegRead, legacyEnabled, HKCU, %h_RegSubkey%, %subKey%|%bkPre%
  2051.         If ( Not legacyEnabled ) {
  2052.          subKey = %bkApplication% ; generic app (without class)
  2053.             RegRead, legacyEnabled, HKCU, %h_RegSubkey%, %subKey%|%bkPre%
  2054.       }
  2055.  
  2056.       ; read out app|class|bk_wt or app|class|sm_wt for window titles
  2057.       RegRead, wtList, HKCU, %h_RegSubkey%, %subKey%|%bkPre%_wt
  2058.       If ( ErrorLevel Or wtList = "" )
  2059.       {  ; legacy mode
  2060.          bkEnabled = %legacyEnabled%
  2061.       }
  2062.       Else
  2063.       {  ; extended mode (scan for window title or window id)
  2064.          StringSplit, wtList, wtList, |
  2065.          Loop, %wtList0%
  2066.          {
  2067.             regTit := wtList%A_Index%
  2068.             ; check for possible window id
  2069.             If ( InStr( regTit, "0x", TRUE ) = 1 ) {
  2070.                If ( regTit = tmpWinID ) {
  2071.                   bkEnabled := TRUE
  2072.                   Break
  2073.                }
  2074.             }
  2075.             ; check for matching window title (RegEx)
  2076.             WinGetTitle, winTit, ahk_id %tmpWinID%
  2077.             If ( RegExMatch( winTit, regTit ) ) {
  2078.                bkEnabled := TRUE
  2079.                Break
  2080.             }
  2081.          }
  2082.       }
  2083.  
  2084.       ; note: bkNoMin does only affect StartupMinimize!
  2085.       ;       other cases will be handled by Helper.
  2086.       If ( m2t_NoMinGlobal )
  2087.          bkNoMin := TRUE
  2088.       Else {
  2089.          bkNoMin := FALSE
  2090.          ; read out app|class|nm for "no minimize"
  2091.          RegRead, bkNoMin, HKCU, %h_RegSubkey%, %bkApplication%|nm   ; generic app
  2092.         If ( Not bkNoMin )
  2093.             RegRead, bkNoMin, HKCU, %h_RegSubkey%, %bkApplication%|%bkClass%|nm
  2094.       }
  2095.  
  2096.       ; remember id of window if not already done
  2097.       If ( Not bkReactivateID )
  2098.          bkReactivateID = %tmpWinID%
  2099.  
  2100.         ; 0 = opt-out mode: hide all windows, BUT user-specified ones
  2101.         ; 1 = opt-in mode : hide ONLY user-specified windows
  2102.         ; 2 = topmost mode: hide all windows, BUT the topmost (active) one
  2103.         If (( fbkMode = 1 AND bkEnabled ) OR ( fbkMode = 0 AND Not bkEnabled ))
  2104.          OR ( fbkMode = 2 AND tmID <> tmpWinID )
  2105.       {
  2106.            bkHideID++
  2107.            bkHideID%bkHideID% := tmpWinID
  2108.  
  2109.          ; read out app|class|jta_e for JustTriggerAction
  2110.          If ( smMode ) {
  2111.             RegRead, tmp, HKCU, %h_RegSubkey%, %subKey%|jta_e
  2112.                If ( tmp ) {
  2113.                   bkJTA%bkHideID% := TRUE
  2114.                   bkNoMin := TRUE
  2115.                }
  2116.          }
  2117.  
  2118.          ; skip starting of new helper if already SM'ed
  2119.          If ( smMode ) {
  2120.             If Not InStr(m2t_smList, tmpWinID "|", TRUE) {
  2121.                ; first: minimize to task bar (for a smooth experience :-)
  2122.                If ( Not bkNoMin ) {
  2123.                    WinMinimize, ahk_id %tmpWinID%
  2124.                 }
  2125.             }
  2126.          }
  2127.  
  2128.            ; reset remembered id if win is the one that gets hidden
  2129.            If ( bkReactivateID = tmpWinID )
  2130.               bkReactivateID = 0
  2131.         }
  2132.     }
  2133.    ; make remembered window active again
  2134.    If ( bkReactivateID ) {
  2135.       Sleep, 75
  2136.       IfWinNotActive, ahk_id %bkReactivateID%
  2137.          WinActivate
  2138.    }
  2139.  
  2140.    ; go and hide windows
  2141.    If ( bkHideID = 0 )
  2142.       Return FALSE   ; nothing to hide, pal
  2143.    Else If ( multiWin )
  2144.    {  ; hide to ONE icon
  2145.       f_StartNewHelper( "RESET" )
  2146.       Loop, %bkHideID%
  2147.       {
  2148.          WinID := bkHideID%A_Index%
  2149.          f_StartNewHelper( "ADD", WinID )
  2150.       }
  2151.       f_StartNewHelper( "SUBMIT", "BossKey'ed" )
  2152.    }
  2153.    Else
  2154.    {  ; hide to MULTIPLE icons
  2155.       Loop, %bkHideID%
  2156.       {
  2157.          WinID := bkHideID%A_Index%
  2158.  
  2159.          ; skip starting of new helper if already SM'ed
  2160.          If ( smMode )
  2161.             If InStr(m2t_smList, WinID "|", TRUE)
  2162.                Continue
  2163.  
  2164.          ; doJTA = TRUE if we are in SM mode and user set JTA
  2165.          doJTA := bkJTA%A_Index%
  2166.          f_StartNewHelper( "ASAP", WinID, doJTA )
  2167.  
  2168.          ; if in "StartupMinimize" mode:
  2169.          ; add this window id to list of already processed ones
  2170.          If ( smMode )
  2171.             m2t_smList = %m2t_smList%%WinID%|
  2172.       }
  2173.    }
  2174.    Return TRUE
  2175. }
  2176.  
  2177. f_StartNewHelper( listCmd="", winID=FALSE, doJTA=FALSE )
  2178. {  ; returns TRUE on success or the list of window IDs ("GET")
  2179.    Global  ; assumption: all vars are global except those declared Local
  2180.    Local h_CaptionHeight, h_BorderHeight, h_MouseX, h_MouseY, h_WindowWidth
  2181.    Local h_WinStyle, h_ID, h_newPID, cmdLine, winCount, max, helperTitle
  2182.    Static listID  ; listID: list of memorized window IDs seperated by "|"
  2183.  
  2184.    ; commands
  2185.    If ( listCmd = "SUBMIT" ) {
  2186.       If ( listID = "" )
  2187.          Return   ; nothing on list
  2188.       If ( winID )
  2189.       {  ; cut title to 25 chars, max.
  2190.          StringLeft, tmp, winID, 25
  2191.          helperTitle = "%tmp%"
  2192.       }
  2193.       Else
  2194.          helperTitle = "MultiWindows"
  2195.       winID = %listID%
  2196.       Gosub, h_suStartNewHelper1
  2197.       Return TRUE
  2198.    }
  2199.    Else If ( listCmd = "RESET" ) {
  2200.       listID =
  2201.       Return TRUE
  2202.    }
  2203.    Else If ( listCmd = "GET" )
  2204.       Return listID
  2205.  
  2206.    ; check window ID
  2207.     If ( winID ) {
  2208.       IfWinNotExist, ahk_id %winID%
  2209.          Return FALSE
  2210.     } Else {
  2211.       ; test class of currently active window
  2212.       If f_IsForbiddenWinClass()
  2213.          ; instead of "forbidden" window (tray, etc.)
  2214.          ; use the last active window
  2215.          SendInput, !{ESC}
  2216.         ; now set "last used window"
  2217.       WinWait, A, , 1
  2218.       If ( ErrorLevel )
  2219.          ; it timed out, so return an error
  2220.          Return FALSE
  2221.       ; retrieve window ID
  2222.       WinGet, winID, ID
  2223.     }
  2224.    WinGet, winStyle, Style ; winID found, lastfoundwin set
  2225.    If ( m2t_ForcedMode )
  2226.       cmpWinStyle = 0x10000000   ; ( WS_VISIBLE )
  2227.    Else
  2228.       cmpWinStyle = 0x10020000   ; ( WS_VISIBLE | WS_MINIMIZEBOX )
  2229.    If Not ( winStyle & cmpWinStyle = cmpWinStyle )
  2230.       Return FALSE   ; window style not suitable for hiding
  2231.  
  2232.    ; commands needing "winID"
  2233.    If ( listCmd = "ADD" ) {
  2234.       listID = %listID%%winID%|
  2235.       Return TRUE ; right now do nothing but adding
  2236.    }
  2237.    Else If ( listCmd = "ASAP" ) {
  2238.       Gosub, h_suStartNewHelper1  ; minimize immediately
  2239.       Return TRUE
  2240.    }
  2241.    Else If ( listCmd = "MOUSE" ) { ; otherwise check if middle-click on title-bar
  2242.       CoordMode, Mouse, Relative
  2243.       SysGet, h_CaptionHeight, 4    ; SM_CYCAPTION
  2244.       SysGet, h_BorderHeight, 7 ; SM_CXDLGFRAME
  2245.       MouseGetPos, h_MouseX, h_MouseY
  2246.       If (( h_MouseY > 0 ) And ( h_MouseY < h_CaptionHeight + h_BorderHeight )) {
  2247.          WinGetPos, , , h_WindowWidth
  2248.          If (( h_MouseX > 0 ) And ( h_MouseX < h_WindowWidth ))
  2249.             Gosub, h_suStartNewHelper1
  2250.             Return TRUE
  2251.       } Else
  2252.          MouseClick, Middle
  2253.    }
  2254.    Return FALSE
  2255.  
  2256.    ; sub-routines for this function
  2257.    h_suStartNewHelper1:
  2258.      ; if there are more then "max" window ID, spawn another helper
  2259.       ; this hopefully avoids too long command lines
  2260.       max = 15
  2261.       StringSplit, tmpID, winID, |
  2262.       winCount = 0
  2263.       Loop, %tmpID0%
  2264.       {
  2265.          tmp := tmpID%A_Index%
  2266.          If ( tmp ) {
  2267.             cmdline = %cmdline% %tmp%
  2268.             winCount++
  2269.          }
  2270.          If ( winCount = max ) {
  2271.             Gosub, h_suStartNewHelper2
  2272.             winCount = 0
  2273.             cmdline =
  2274.          }
  2275.       }
  2276.       ; if there was some "left-over"
  2277.       If ( winCount > 0 )
  2278.          Gosub, h_suStartNewHelper2
  2279.    Return
  2280.  
  2281.    ; another sub routine just for spawning the helper
  2282.    h_suStartNewHelper2:
  2283.      ; if "helperTitle" is set, user wants to spawn a "MultiMode" helper
  2284.       If ( helperTitle )
  2285.          cmdLine = %helperTitle% %cmdLine%
  2286.       Else If ( doJTA )
  2287.          cmdLine = __justTriggerAction__ %cmdLine%
  2288.  
  2289.       If ( A_IsCompiled )
  2290.          Run, "%A_ScriptFullPath%" %cmdLine%, , UseErrorLevel, h_newPID
  2291.       Else
  2292.         Run, "%h_ahkFullPath%" "%A_ScriptFullPath%" %cmdLine%, , UseErrorLevel, h_newPID
  2293.      
  2294.       If ( ErrorLevel = "ERROR" )   ; helper could not be started
  2295.         Return
  2296.      
  2297.       h_hPIDcount++
  2298.       h_helperPIDs%h_hPIDcount% = %h_newPID%
  2299.    Return  
  2300. }
  2301.  
  2302. f_BossKeyListToggleWin()
  2303. {  ; add or remove current window to/from BossKey list
  2304.    Global lng_BKListToggleOn, lng_BKListToggleOff, h_RegSubkey
  2305.  
  2306.    WinGet, h_WinID, ID, A
  2307.    Loop
  2308.    {
  2309.       endFunction := FALSE
  2310.  
  2311.       ; set last used win
  2312.       WinWait, ahk_id %h_WinID%,, 1
  2313.       If ( ErrorLevel )
  2314.       {  ; It timed out, so go on with next window id
  2315.          endFunction := TRUE
  2316.         Break
  2317.       }
  2318.      
  2319.       WinGetClass, h_Class
  2320.       WinGet, h_Application, ProcessName
  2321.    
  2322.       ; substitution of "evil class"
  2323.       newWinID := f_SubstEvilClass( h_WinID, h_Class, h_Application )
  2324.       If ( h_WinID = newWinID )
  2325.          ; no substitution: leave the loop!
  2326.          Break
  2327.       Else
  2328.          ; go another looping round with new content in h_WinID...
  2329.          h_WinID := newWinID
  2330.    }
  2331.    If ( endFunction )
  2332.       Return
  2333.  
  2334.    If f_IsForbiddenWinClass( h_Class )
  2335.     Return
  2336.  
  2337.     WinGetTitle, title
  2338.    If StrLen(title) > 50
  2339.    {
  2340.       StringLeft, title, title, 47
  2341.       title = %title%...
  2342.    }
  2343.  
  2344.     RegRead, bkEnabled, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk   ; app+class on bosskey list?
  2345.    If ( ErrorLevel Or Not bkEnabled ) {
  2346.         RegWrite, REG_SZ, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk, 1
  2347.       txt = "%title%":`n%lng_BKListToggleOn%
  2348.     }
  2349.     Else {
  2350.         RegDelete, HKCU, %h_RegSubkey%, %h_Application%|%h_Class%|bk
  2351.       txt = "%title%":`n%lng_BKListToggleOff%
  2352.     }
  2353.  
  2354.    f_TrayTip(txt)
  2355.    Return
  2356. }
  2357.  
  2358. ;-----------------------------------------------------------------------------
  2359. ; Starter error -- subs
  2360. ;
  2361.  
  2362. ExitWithAHKError:
  2363.   f_ShowErrorMsg( lng_ExitWithAHKError )
  2364. ExitApp, 1
  2365.  
  2366. ExitWithRunningError:
  2367.   f_ShowErrorMsg( lng_ExitWithRunningError )
  2368. ExitApp, 1
  2369.  
  2370. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2371. ; general -- subs
  2372. ;
  2373.  
  2374. h_InitGeneral:
  2375.   ; at least this version of AHK is needed
  2376.    h_MinReqAHK = 1.0.47.01
  2377.    ; key in HKCU to store stuff under
  2378.    h_RegSubkey = Software\KTC\Min2Tray
  2379.    ; set "generic" language
  2380.    f_SetLanguage( "general" )  
  2381.    ; some sanity checks  
  2382.    If ( A_OSType <> "WIN32_NT" ) {
  2383.       f_ShowErrorMsg( lng_ExitWithOSError )
  2384.       ExitApp, 1
  2385.    }
  2386.    If ( A_AhkVersion < h_MinReqAHK ) {
  2387.       f_ShowErrorMsg( lng_ExitWithVersionError )
  2388.       ExitApp, 1
  2389.    }
  2390.    ; user defined/ default tray icon for starter and as default helper icon
  2391.    h_StarterIcon  = %A_ScriptDir%\Min2Tray.ico
  2392.    h_StarterIcon# = 1
  2393.    If Not FileExist( h_StarterIcon ) {
  2394.       If ( A_IsCompiled )
  2395.          h_StarterIcon  = %A_ScriptFullPath%
  2396.       Else {
  2397.          h_StarterIcon  = %A_WinDir%\system32\shell32.dll
  2398.          h_StarterIcon# = 175 ; 25
  2399.       }
  2400.    }
  2401.    ; --- get registry settings
  2402.    ; DebugMode - throw some debug infos into logfile
  2403.     RegRead, m2t_DebugMode, HKCU, %h_RegSubkey%\Misc, DebugMode
  2404.     If ( m2t_DebugMode )
  2405.        m2t_DebugMode := TRUE
  2406.     Else
  2407.       m2t_DebugMode := FALSE
  2408.    ; Jaakon's mode - prompt for custom name if none present
  2409.     RegRead, m2t_JaakonMode, HKCU, %h_RegSubkey%\Misc, JaakonMode
  2410.     If ( m2t_JaakonMode )
  2411.        m2t_JaakonMode := TRUE
  2412.     Else
  2413.       m2t_JaakonMode := FALSE
  2414.    ; NoMinimizeGlobal - globally enable "nominimize" for all apps
  2415.     RegRead, m2t_NoMinGlobal, HKCU, %h_RegSubkey%\Misc, NoMinimize
  2416.     If ( m2t_NoMinGlobal )
  2417.        m2t_NoMinGlobal := TRUE
  2418.     Else
  2419.       m2t_NoMinGlobal := FALSE
  2420.    ; DontBugMe - switch off all notifications (tray tip, tool tip)
  2421.     RegRead, m2t_DontBugMe, HKCU, %h_RegSubkey%\Misc, DontBugMe
  2422.     If ( m2t_DontBugMe )
  2423.        m2t_DontBugMe := TRUE
  2424.     Else
  2425.       m2t_DontBugMe := FALSE
  2426.    ; 1 or 2 click menu?
  2427.     RegRead, m2t_clickCount, HKCU, %h_RegSubkey%\Misc, ClickCount
  2428.     If m2t_clickCount not in 1,2
  2429.        m2t_clickCount := 1
  2430. Return
  2431.  
  2432. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2433. ; general -- functions
  2434. ;
  2435.  
  2436. f_IsForbiddenWinClass( winClass="", addForbidWC="" )
  2437. {  ; return TRUE if winClass is "fobidden"
  2438.    ; if winClass is not supplied, takes the currently active window
  2439.    static forbidWC   ; not needed, but for speed up!
  2440.    ; M2T will not touch any of these window classes
  2441.    forbidWC = ,%addForbidWC%,Shell_TrayWnd,Progman,WorkerW,tooltips_class32,
  2442.    ; take the currently active window
  2443.    If ( Not winClass )
  2444.       WinGetClass, winClass, A
  2445.  
  2446.    f_DebugLog( "f_IsForbiddenWinClass", "winClass: " winClass ", forbidWC: " forbidWC )
  2447.  
  2448.    ; check for a match, but first split window class on ".",
  2449.    ; i.e. "TfPSPad.UnicodeClass" becomes "TfPSPad"  
  2450.    StringSplit, needle, winClass, .
  2451.    If needle0 And InStr(forbidWC, "," . needle1 . ",", TRUE)
  2452.       Return TRUE
  2453.    ; default: no match found
  2454.    Return FALSE
  2455. }
  2456.  
  2457. f_SubstEvilClass( winID, eClass="", eAppName="" )
  2458. {  ; class substitution (needed only for Evil Classes >:-|
  2459.    ; winID must be passed to this function
  2460.    ; eClass and eAppName are optional
  2461.    ; returns winID (either substituted or passed one)
  2462.    Global h_RegSubkey
  2463.  
  2464.    If ( Not eClass )
  2465.       WinGetClass, eClass, ahk_id %winID%
  2466.  
  2467.    If ( Not eAppName )
  2468.       WinGet, eAppName, ProcessName, ahk_id %winID%
  2469.  
  2470.     ; substitute "evil class" with "good class" if available
  2471.    eRegKey = %eAppName%|%eClass%|ec
  2472.    RegRead, goodClass, HKCU, %h_RegSubkey%, %eRegKey%
  2473.    If ( ErrorLevel Or Not goodClass )
  2474.    {  ; substitute known "evil classes"
  2475.       If InStr(eRegKey, "PSPad.exe|TfPSPad", TRUE) ; for PSPad
  2476.          goodClass = TApplication
  2477.    }
  2478.  
  2479.    ; get new unique window id with help of "good class" and "evil PID"
  2480.    If ( goodClass ) {
  2481.       WinGet, ePID, PID, ahk_id %winID%
  2482.       WinGet, winID, ID, ahk_pid %ePID% ahk_class %goodClass%
  2483.    }
  2484.  
  2485.    ; always return a unique window id
  2486.    Return winID
  2487. }
  2488.  
  2489. f_StealthMode( dowhat="" )
  2490. {  ; manipulate StealthMode registry setting
  2491.    ; dowhat may be "ON", "OFF" or "" (for "toggle")
  2492.    Global h_RegSubkey
  2493.  
  2494.    mode := 0
  2495.     If ( dowhat = "ON" )
  2496.        mode := 1
  2497.     Else If ( dowhat = "OFF" )
  2498.        mode := 0
  2499.     Else {
  2500.     RegRead, mode, HKCU, %h_RegSubkey%\Misc, StealthMode
  2501.     mode := Not mode
  2502.     }
  2503.  
  2504.    If ( mode )
  2505.        RegWrite, REG_SZ, HKCU, %h_RegSubkey%\Misc, StealthMode, 1
  2506.    Else
  2507.        RegDelete, HKCU, %h_RegSubkey%\Misc, StealthMode
  2508. }
  2509.  
  2510. f_PositionWindow( winID="", newpos="", shutup=FALSE )
  2511. {  ; position the active window
  2512.    ; newpos = "X, Y, W, H" where any element may be blank
  2513.    Global lng_Postraytip
  2514.  
  2515.    If ( Not newpos )
  2516.       Return
  2517.  
  2518.    ; set LastFoundWindow
  2519.    If ( winID )
  2520.       winID = ahk_id %winID%
  2521.    Else
  2522.       winID = A
  2523.    IfWinNotExist, %winID%
  2524.       Return
  2525.  
  2526.    ; split on comma, remove spaces and tabs from elements
  2527.    StringSplit, new, newpos, `,, %A_Space%%A_Tab%
  2528.    If ( new0 = 0 )
  2529.       Return
  2530.  
  2531.    ; get current position
  2532.    WinGetPos, cur1, cur2, cur3, cur4
  2533.    ; and compare to new/wanted position
  2534.    If ( (cur1 = new1 Or new1 = "")
  2535.          And (cur2 = new2 Or new2 = "")
  2536.          And (cur3 = new3 Or new3 = "")
  2537.          And (cur4 = new4 Or new4 = "") )
  2538.       Return
  2539.  
  2540.    ; position window
  2541.    WinMove, , , new1, new2, new3, new4
  2542.  
  2543.    ; show tray tip
  2544.    If ( Not shutup ) {
  2545.     WinGetActiveTitle, title
  2546.       If ( StrLen(title) > 50 ) {
  2547.          StringLeft, title, title, 47
  2548.          title = %title%...
  2549.       }
  2550.       txt = "%title%":`n%lng_Postraytip%
  2551.       f_TrayTip(txt)
  2552.    }
  2553. }
  2554.  
  2555. f_MaxWindow( winID="", orient="", shutup=FALSE )
  2556. {   ; maximize the active window either horizontally or vertically
  2557.    ; orient may be "X", "Y" or "A" for both directions
  2558.    ; set shutup to disable tray tip
  2559.     Global m2t_ForcedMode, lng_YMaxtraytip, lng_YMaxNottraytip
  2560.    Global lng_XMaxtraytip, lng_XMaxNottraytip
  2561.    Global lng_AMaxtraytip, lng_AMaxNottraytip
  2562.  
  2563.    If orient in Y,X,A
  2564.    {
  2565.       lng_Maxtraytip    := lng_%orient%Maxtraytip
  2566.       lng_MaxNottraytip := lng_%orient%MaxNottraytip
  2567.    }
  2568.    Else
  2569.       Return
  2570.  
  2571.    ; set LastFoundWindow
  2572.    If ( winID )
  2573.       winID = ahk_id %winID%
  2574.    Else
  2575.       winID = A
  2576.    IfWinNotExist, %winID%
  2577.       Return
  2578.  
  2579.    WinGet, max, MinMax
  2580.    If ( max )
  2581.       Return   ; do not maximize windows that are already maximized by system
  2582.  
  2583.    SysGet, mon, MonitorWorkArea
  2584.     WinGetPos, curX, curY, curW, curH
  2585.  
  2586.     If ( orient="Y" AND curY=monTop AND curH=monBottom )
  2587.       Or ( orient="X" AND curX=monLeft AND curW=monRight )
  2588.       Or ( orient="A" AND curY=monTop AND curH=monBottom  AND curX=monLeft AND curW=monRight )
  2589.         Return  ; do not y-max or x-max if window is already maxed by this script
  2590.  
  2591.    ; prepare title for traytip
  2592.     WinGetActiveTitle, title
  2593.     If StrLen(title) > 50
  2594.     {
  2595.        StringLeft, title, title, 47
  2596.        title = %title%...
  2597.     }
  2598.  
  2599.    If ( Not m2t_ForcedMode )
  2600.    {  ; do not force maximization
  2601.     WinGet, winStyle, Style
  2602.     If ( winStyle & 0x40000 <> 0x40000 )
  2603.     {
  2604.          If ( Not shutup ) {
  2605.             txt = "%title%":`n%lng_MaxNottraytip%
  2606.             f_TrayTip(txt)
  2607.          }
  2608.         Return  ; do not max if window has no WS_SIZEBOX style
  2609.     }
  2610.    }
  2611.  
  2612.    If ( orient="Y" )
  2613.       WinMove, , , , %monTop%, , %monBottom%
  2614.    Else If ( orient="X" )
  2615.       WinMove, , , %monLeft%, , %monRight%
  2616.    Else
  2617.       WinMove, , , %monLeft%, %monTop%, %monRight%, %monBottom%
  2618.  
  2619.    ; show tray tip
  2620.    If ( Not shutup ) {
  2621.     txt = "%title%":`n%lng_Maxtraytip%
  2622.     f_TrayTip(txt)
  2623.     }
  2624.  
  2625.     Return
  2626. }
  2627.  
  2628. f_NoButtons( winID="", dowhat="", shutup=FALSE )
  2629. {  ; show or hide all the buttons (SysMenu) of window title-bar
  2630.    ; dowhat may be "ON", "OFF" or "" (for "toggle")
  2631.    Global lng_NoBtraytip
  2632.  
  2633.    ; set LastFoundWindow
  2634.    If ( winID )
  2635.       winID = ahk_id %winID%
  2636.    Else
  2637.       winID = A
  2638.    IfWinNotExist, %winID%
  2639.       Return
  2640.  
  2641.    ; check current style
  2642.    WinGet, wstyle, Style
  2643.    wstyle := wstyle & 0x80000
  2644.    If ( (wstyle = 0x80000) And (dowhat = "" Or dowhat = "ON") ) {
  2645.       ; remove buttons
  2646.       WinSet, Style, -0x80000
  2647.  
  2648.       ; show balloon info
  2649.       If ( Not shutup ) {
  2650.         WinGetActiveTitle, title
  2651.          If ( StrLen(title) > 50 ) {
  2652.             StringLeft, title, title, 47
  2653.             title = %title%...
  2654.          }
  2655.          txt = "%title%":`n%lng_NoBtraytip%
  2656.          f_TrayTip(txt)
  2657.       }
  2658.    }
  2659.    Else If (dowhat = "" Or dowhat = "OFF") {
  2660.      ; show buttons again
  2661.       WinSet, Style, +0x80000
  2662.    }
  2663.    Return
  2664. }
  2665.  
  2666. f_AlwaysOnTop( winID="", dowhat="", shutup=FALSE )
  2667. {  ; make active window "always on top" or remove
  2668.    ; "aot" from window if this style is already present,
  2669.    ; indicate "aot" by doing some fancy stuff to the window
  2670.    ; dowhat may be "ON", "OFF" or "" (for "toggle")
  2671.    Global lng_AOTtraytip, h_RegSubkey
  2672.      
  2673.    ; set LastFoundWindow
  2674.    If ( winID )
  2675.       winID = ahk_id %winID%
  2676.    Else
  2677.       winID = A
  2678.    IfWinNotExist, %winID%
  2679.       Return
  2680.  
  2681.    ; Desktop and Tray cannot be made AOT
  2682.    WinGetClass, class
  2683.    If f_IsForbiddenWinClass( class )
  2684.     Return
  2685.  
  2686.    WinGet, xstyle, ExStyle
  2687.    If ( (xstyle & 0x8) And (dowhat = "" Or dowhat = "OFF") ) {
  2688.       ;           0x8 is WS_EX_TOPMOST.
  2689.       ; remove always-on-top
  2690.       WinSet, AlwaysOnTop, Off
  2691.       ; remove tranxparency
  2692.       WinGet, trans, Transparent
  2693.       If ( trans ) {
  2694.          WinSet, Transparent, 255
  2695.          Sleep, 50
  2696.          WinSet, Transparent, Off
  2697.       }
  2698.       f_TrayTip("")
  2699.    }
  2700.    Else If (dowhat = "" Or dowhat = "ON") {
  2701.       ; make it always-on-top
  2702.       WinSet, AlwaysOnTop, On
  2703.       ; get custom transparency
  2704.     RegRead, trans, HKCU, %h_RegSubkey%\Starter, TransparentAOT
  2705.       If ( trans < 1 OR trans > 255 )
  2706.          trans = 0   ; default: no transparency
  2707.       ; set window transparency
  2708.       If ( trans > 0 )
  2709.          WinSet, Transparent, %trans%
  2710.       ; show balloon info
  2711.       If ( Not shutup ) {
  2712.          WinGetActiveTitle, title
  2713.          If ( StrLen(title) > 50 ) {
  2714.             StringLeft, title, title, 47
  2715.             title = %title%...
  2716.          }
  2717.          txt = "%title%":`n%lng_AOTtraytip%
  2718.          f_TrayTip(txt)
  2719.       }
  2720.    }
  2721.    Return
  2722. }
  2723.  
  2724. f_DebugLog( logSrc="", logText="" )
  2725. {  ; log "time <src> text" to logFile
  2726.    ; if debugging is activated
  2727.    Global m2t_DebugMode
  2728.    If ( Not m2t_DebugMode )
  2729.       Return
  2730.    If ( logSrc = "" OR logText = "" )
  2731.       Return
  2732.    logFile = debug.log
  2733.    logText = %A_Now% <%logSrc%> %logText%`n
  2734.    FileAppend, %logText%, %logFile%
  2735. }
  2736.  
  2737. f_ShowErrorMsg( error_text="" )
  2738. {  ; show window with an error message
  2739.    Global lng_WindowTitle, h_RegSubkey
  2740.  
  2741.    If ( error_text = "" )
  2742.       Return
  2743.  
  2744.    ; skip showing if registry key is set
  2745.     RegRead, show_msg, HKCU, %h_RegSubkey%\Misc, NoErrorMessages
  2746.     If ( Not show_msg )
  2747.       Msgbox, 48, %lng_WindowTitle%, %error_text%
  2748. }
  2749.  
  2750. f_FindFile( name, startPath )
  2751. {
  2752.    StringRight, tmp, startPath, 1
  2753.    If ( ( tmp <> "" ) and ( tmp <> "\" ) )
  2754.       startPath = %startPath%\
  2755.    ; start file search
  2756.    Loop, %startPath%%name%, 0, 1
  2757.    {
  2758.       appExe = %A_LoopFileLongPath%
  2759.       IfExist, %appExe%
  2760.          Break      ; exit with first found app or ""
  2761.    }
  2762.    Return %appExe%
  2763. }
  2764.  
  2765. f_ShowTrayIcon( file, number )
  2766. {
  2767.    Global h_RegSubkey, h_StarterIcon, h_StarterIcon#
  2768.  
  2769.    Menu, TRAY, UseErrorLevel
  2770.     RegRead, stealth, HKCU, %h_RegSubkey%\Misc, StealthMode ; are we in StealthMode?
  2771.     If ( Not ErrorLevel )
  2772.         If ( stealth )
  2773.         {
  2774.             If ( Not A_IconHidden )
  2775.                 Menu, TRAY, NoIcon
  2776.             Return
  2777.         }
  2778.  
  2779.     If ( Not A_IconHidden ) ; coming from hidden icon: ALWAYS renew icon!
  2780.         If ( A_IconFile = file AND A_IconNumber = number )  ; icon props not changed
  2781.             Return
  2782.  
  2783.    IfExist, %file%
  2784.    {
  2785.       Menu, TRAY, Icon, %file%, %number%, 1  ; 1=freeze icon
  2786.       If ( Not ErrorLevel ) ; if ErrorLevel was NOT raised -> allright
  2787.          Goto, OKout
  2788.    }
  2789.  
  2790.    ; if ErrorLevel or not existing file -> set default icon
  2791.    Menu, TRAY, Icon, %h_StarterIcon%, %h_StarterIcon#%, 1 ; 1=freeze icon
  2792.  
  2793.    OKout:
  2794.       Menu, TRAY, Icon  ; show icon
  2795.       Menu, TRAY, UseErrorLevel, Off
  2796.    Return
  2797. }
  2798.  
  2799. f_AssignHotkey( hkey, hlabel="" )
  2800. {  ; - assign exactly one hotkey to a label
  2801.    ; - return TRUE if assignment succeeded
  2802.    ;   otherwise FALSE
  2803.    ; - remove hotkey if no label is passed
  2804.    ;   (returns TRUE if there was no error)
  2805.    retVal := FALSE
  2806.  
  2807.    If ( hkey = "" )
  2808.       Return retVal
  2809.  
  2810.    ; if label is valid -> assign new key to label
  2811.    If IsLabel( hlabel )
  2812.    {  ; assign new key
  2813.       Hotkey, %hkey%, %hlabel%, UseErrorLevel
  2814.       If ( Not ErrorLevel )
  2815.          Hotkey, %hkey%, On
  2816.             If ( Not ErrorLevel )
  2817.                retVal := TRUE
  2818.    }
  2819.    Else
  2820.    {  ; if no valid label -> remove hotkey
  2821.       Hotkey, %hkey%, Off, UseErrorLevel
  2822.          If ( Not ErrorLevel )
  2823.             retVal := TRUE
  2824.    }
  2825.    Return retVal
  2826. }
  2827.  
  2828. f_ComposeHotkey( chNewKey, chWinKey, chKey, chLabel, chRegSub, chRegKey, chErrorMsg )
  2829. {  ; check hotkey, assign and write it to registry
  2830.    ; returns new hotkey as string
  2831.    ; or "__invalid__" if assignment failed
  2832.    ; or "" if hotkey was removed
  2833.    Global h_RegSubkey, lng_SetupInvalidHotkey1, lng_SetupInvalidHotkey2
  2834.  
  2835.    ; remove old hotkey
  2836.    success := f_AssignHotkey( chKey )
  2837.  
  2838.    f_DebugLog( "f_ComposeHotkey", "f_AssignHotkey remove: success=" success " chNewKey=" chNewKey " chOldKey=" chKey " chLabel=" chLabel )
  2839.  
  2840.    If ( success ) {
  2841.       RegDelete, HKCU, %h_RegSubkey%\%chRegSub%, %chRegKey%
  2842.       chKey =
  2843.    }
  2844.    
  2845.    ; set new hotkey
  2846.    If ( chNewKey ) {
  2847.       ; do some substitution (for authors convenience)
  2848.       StringReplace, chNewKey, chNewKey, ZIRKUMFLEX, SC029
  2849.       StringReplace, chNewKey, chNewKey, AKUT, SC00D
  2850.  
  2851.       ; add WIN modifier if option checked
  2852.       If ( chWinKey )
  2853.          chNewKey = #%chNewKey%
  2854.  
  2855.       ; is there not at least one modifier (WIN, CTRL, ALT, SHIFT) in the new key
  2856.       If chNewKey not contains #,^,!,+
  2857.          chNewKey =
  2858.  
  2859.       ; trying to assign new hotkey
  2860.       success := f_AssignHotkey( chNewKey, chLabel )
  2861.  
  2862.       f_DebugLog( "f_ComposeHotkey", "f_AssignHotkey assign: success=" success " chNewKey=" chNewKey " chOldKey=" chKey " chLabel=" chLabel )
  2863.  
  2864.       If ( success ) {
  2865.          chKey = %chNewKey%
  2866.          RegWrite, REG_SZ, HKCU, %h_RegSubkey%\%chRegSub%, %chRegKey%, %chKey%
  2867.       }
  2868.       Else {
  2869.          chKey = __invalid__
  2870.          Msgbox, 48, %h_MenuWin%, %lng_SetupInvalidHotkey1%%chErrorMsg%%lng_SetupInvalidHotkey2%
  2871.       }
  2872.    }
  2873.    ; return the new Key (or "") to be used outside this function
  2874.    Return chKey
  2875. }
  2876.  
  2877. f_TrayTip( txt="", secs=5 )
  2878. {  ; show a traytip
  2879.    Global lng_WindowTitle, m2t_DontBugMe
  2880.  
  2881.    If ( m2t_DontBugMe )
  2882.       Return
  2883.  
  2884.    If ( txt = "" )
  2885.    {  ; remove traytip
  2886.       TrayTip
  2887.       Return
  2888.    }
  2889.    
  2890.    If ( secs >= 1 AND secs <= 20 )
  2891.       msecs := secs * 1000
  2892.    Else
  2893.       msecs = 5000
  2894.  
  2895.    TrayTip, %lng_WindowTitle%, %txt%, 20, 17 ; nopopupsound+info
  2896.    SetTimer, f_TTRemoveTrayTip, %msecs%
  2897.    Return
  2898.    
  2899.    f_TTRemoveTrayTip:
  2900.      SetTimer, f_TTRemoveTrayTip, Off
  2901.       TrayTip
  2902.       Return
  2903. }
  2904.  
  2905. f_StringLeft( txt, len=80 )
  2906. {  ; get string from left with custom length
  2907.    If ( StrLen( txt ) > len ) {
  2908.       StringLeft, txt, txt, %len%
  2909.    }
  2910.    Return txt
  2911. }
  2912.  
  2913. f_TriggerAction( winID, valName, subKey="", winTitle="" )
  2914. {  ; read out registry value and then
  2915.    ; trigger an action accordingly:
  2916.    ; send key strokes, run program, show message, play sound;
  2917.    ; if subKey = "__parse__" then string in valName will just be parsed
  2918.    ; returns TRUE if parsing succeeded
  2919.    ; if subKey = "__override__" then disable check for eventsEnabled
  2920.    ; if wintitle = "__readout__" then we just return the registry value
  2921.    ; winID will be passed to the underlying functions
  2922.    Global whoami, h_RegSubkey, lng_WindowTitle
  2923.    Global h_taActiveWinID
  2924.  
  2925.     RegRead, eventsEnabled, HKCU, %h_RegSubkey%\Misc, EventsEnabled
  2926.     If ( Not eventsEnabled
  2927.         And Not ( subKey = "__parse__" Or subKey = "__override__"
  2928.                   Or winTitle = "__readout__" ) )
  2929.       Return
  2930.  
  2931.    If ( valName = "" )
  2932.       Return TRUE
  2933.      
  2934.    If ( subKey = "" Or subKey = "__override__" )
  2935.       subKey = %h_RegSubkey%
  2936.  
  2937.    If ( subKey = "__parse__" ) {
  2938.       value = %valName%
  2939.       doit := FALSE
  2940.    }
  2941.    Else {
  2942.       RegRead, value, HKCU, %subKey%, %valName%
  2943.       If ( ErrorLevel OR value = "" )
  2944.          Return ""
  2945.       If ( winTitle = "__readout__" )
  2946.          Return value
  2947.       doit := TRUE
  2948.    }
  2949.  
  2950.    Loop, PARSE, value, |
  2951.    {
  2952.       parseOK := FALSE
  2953.  
  2954.       If ( A_LoopField = "" )
  2955.          Continue
  2956.            
  2957.       StringLeft, action, A_LoopField, 4
  2958.       StringTrimLeft, args, A_LoopField, 5
  2959.  
  2960.       f_DebugLog( "f_TriggerAction", "action: " . action . ", args: " . args )
  2961.  
  2962.       If ( action = "key1" ) {
  2963.          ; send simulated keystrokes to the window, activating it first
  2964.          parseOK := TRUE
  2965.          If ( doit ) {
  2966.             WinActivate, ahk_id %winID%
  2967.             SendInput, %args%
  2968.          }
  2969.       }
  2970.       Else If ( action = "key2" ) {
  2971.          ; send simulated keystrokes to the window, activating it first
  2972.          ; you can set the "typing-"delay here, too (first argument)
  2973.          parseOK := TRUE
  2974.          If ( doit ) {
  2975.             ; split on commas
  2976.             StringSplit, tmp, args, `,
  2977.             If ( tmp0 = 2 ) {
  2978.                WinActivate, ahk_id %winID%
  2979.                SetKeyDelay, %tmp1%
  2980.                Send, %tmp2%
  2981.             }
  2982.          }
  2983.       }
  2984.       Else If ( action = "key4" ) {
  2985.          ; send simulated keystrokes to a control's HWND (window handle)
  2986.          ; use this i.e. to send chars to "cmd.exe"
  2987.          parseOK := TRUE
  2988.          If ( doit )
  2989.             ControlSend, , %args%, ahk_id %winID%
  2990.       }
  2991.       Else If ( action = "key5" ) {
  2992.          ; send simulated keystrokes to a specified control (first argument)
  2993.          parseOK := TRUE
  2994.          If ( doit ) {
  2995.             ; split on commas
  2996.             StringSplit, tmp, args, `,
  2997.             If ( tmp0 = 2 )
  2998.                ControlSend, %tmp1%, %tmp2%, ahk_id %winID%
  2999.          }
  3000.       }
  3001.       Else If ( action = "key6" ) {
  3002.          ; send simulated keystrokes to a specified control (second argument)
  3003.          ; you can set the "typing-"delay here, too (first argument)
  3004.          parseOK := TRUE
  3005.          If ( doit ) {
  3006.             ; split on commas
  3007.             StringSplit, tmp, args, `,
  3008.             If ( tmp0 = 3 ) {
  3009.                SetKeyDelay, %tmp1%
  3010.                ControlSend, %tmp2%, %tmp3%, ahk_id %winID%
  3011.             }
  3012.          }
  3013.       }
  3014.       Else If ( action = "act1" ) {
  3015.          ; activate the window (bring it to front)
  3016.          ; this will lead to auto-termination of helper-icon
  3017.          parseOK := TRUE
  3018.          If ( doit ) {
  3019.             WinShow, ahk_id %winID%
  3020.             WinRestore, ahk_id %winID%
  3021.             WinActivate, ahk_id %winID%
  3022.          }
  3023.       }
  3024.       Else If ( action = "act2" ) {
  3025.          ; re-activate memorized "active window for later" (bring it to front)
  3026.          ; see at routine h_Unhide of helper
  3027.          ; useful after un-hiding Topmost-BossKey-windows
  3028.          parseOK := TRUE
  3029.          If ( doit ) {
  3030.             tmp = ahk_id %h_taActiveWinID%
  3031.             If WinExist( tmp )
  3032.                WinActivate, %tmp%
  3033.          }
  3034.       }
  3035.       Else If ( action = "slp1" ) {
  3036.          parseOK := TRUE
  3037.          If ( doit ) {
  3038.             ; pause timer, sleep, un-pause timer
  3039.             SetTimer, h_CheckForWin, Off
  3040.             Sleep, %args%
  3041.             SetTimer, h_CheckForWin, On
  3042.          }
  3043.       }
  3044.       Else If ( action = "run1" ) {
  3045.          parseOK := TRUE
  3046.          If ( doit )
  3047.             Run, %args%, , UseErrorLevel
  3048.       }
  3049.       Else If ( action = "run2" ) {
  3050.          parseOK := TRUE
  3051.          If ( doit )
  3052.             Run, %args%, , Hide UseErrorLevel
  3053.       }
  3054.       Else If ( action = "run3" ) {
  3055.          parseOK := TRUE
  3056.          If ( doit )
  3057.             Run, %args% %winID%, , UseErrorLevel
  3058.       }
  3059.       Else If ( action = "rnw1" ) {
  3060.          parseOK := TRUE
  3061.          If ( doit )
  3062.             RunWait, %args%, , UseErrorLevel
  3063.       }
  3064.       Else If ( action = "rnw2" ) {
  3065.          parseOK := TRUE
  3066.          If ( doit )
  3067.             RunWait, %args%, , Hide UseErrorLevel
  3068.       }
  3069.       Else If ( action = "rnw3" ) {
  3070.          parseOK := TRUE
  3071.          If ( doit )
  3072.             RunWait, %args% %winID%, , UseErrorLevel
  3073.       }
  3074.       Else If ( action = "msg1" ) {
  3075.          parseOK := TRUE
  3076.          If ( doit ) {
  3077.             If ( winTitle = "" )
  3078.                winTitle = %lng_WindowTitle%
  3079.             Else
  3080.                winTitle = %winTitle% - %lng_WindowTitle%
  3081.             Msgbox, 262144, %winTitle%, %args%
  3082.          }
  3083.       }
  3084.       Else If ( action = "snd1" ) {
  3085.          parseOK := TRUE
  3086.          If ( doit )
  3087.             SoundPlay, %args%, WAIT
  3088.       }
  3089.       Else If ( action = "snd2" ) {
  3090.          parseOK := TRUE
  3091.          If ( doit )
  3092.             SoundPlay, %args%
  3093.       }
  3094.       Else If ( action = "aud1" ) {
  3095.          StringUpper, args, args
  3096.          If ( args = "MUTE_ON" ) {
  3097.             parseOK := TRUE
  3098.             If ( doit )
  3099.                SoundSet, 1, , MUTE
  3100.          }
  3101.          Else If ( args = "MUTE_OFF" ) {
  3102.             parseOK := TRUE
  3103.             If ( doit )
  3104.                SoundSet, 0, , MUTE
  3105.          }
  3106.          Else If ( args = "MUTE_TOGGLE" ) {
  3107.             parseOK := TRUE
  3108.             If ( doit )
  3109.                SoundSet, +1, , MUTE
  3110.          }
  3111.       }
  3112.       Else If ( action = "stm1" ) {
  3113.          StringUpper, args, args
  3114.          If ( args = "ON" ) {
  3115.             parseOK := TRUE
  3116.             If ( doit )
  3117.                f_StealthMode( "ON" )
  3118.          }
  3119.          Else If ( args = "OFF" ) {
  3120.             parseOK := TRUE
  3121.             If ( doit )
  3122.                f_StealthMode( "OFF" )
  3123.          }
  3124.          Else If ( args = "TOGGLE" ) {
  3125.             parseOK := TRUE
  3126.             If ( doit )
  3127.                f_StealthMode()
  3128.          }
  3129.       }
  3130.       Else If ( action = "cfw1" And whoami = "helper" ) {
  3131.          StringUpper, args, args
  3132.          If ( args = "ON" ) {
  3133.             parseOK := TRUE
  3134.             If ( doit ) {
  3135.                Gosub, h_CheckForWin ; immediate update
  3136.                SetTimer, h_CheckForWin, On   ; un-pause timer
  3137.             }
  3138.          }
  3139.          Else If ( args = "OFF" ) {
  3140.             parseOK := TRUE
  3141.             If ( doit )
  3142.                SetTimer, h_CheckForWin, Off
  3143.          }
  3144.       }
  3145.       Else If ( action = "aot1" ) {
  3146.          StringUpper, args, args
  3147.          If ( args = "ON" ) {
  3148.             parseOK := TRUE
  3149.             If ( doit )
  3150.                f_AlwaysOnTop( winID, "ON", TRUE )
  3151.          }
  3152.          Else If ( args = "OFF" ) {
  3153.             parseOK := TRUE
  3154.             If ( doit )
  3155.                f_AlwaysOnTop( winID, "OFF", TRUE )
  3156.          }
  3157.       }
  3158.       Else If ( action = "nob1" ) {
  3159.          StringUpper, args, args
  3160.          If ( args = "ON" ) {
  3161.             parseOK := TRUE
  3162.             If ( doit )
  3163.                f_NoButtons( winID, "ON", TRUE )
  3164.          }
  3165.          Else If ( args = "OFF" ) {
  3166.             parseOK := TRUE
  3167.             If ( doit )
  3168.                f_NoButtons( winID, "OFF", TRUE )
  3169.          }
  3170.       }
  3171.       Else If ( action = "max1" ) {
  3172.          StringUpper, args, args
  3173.          If ( args = "X" ) {
  3174.             parseOK := TRUE
  3175.             If ( doit )
  3176.                f_MaxWindow( winID, "X", TRUE )
  3177.          }
  3178.          Else If ( args = "Y" ) {
  3179.             parseOK := TRUE
  3180.             If ( doit )
  3181.                f_MaxWindow( winID, "Y", TRUE )
  3182.          }
  3183.          Else If ( args = "BOTH" Or args = "XY" Or args = "YX" Or args = "A" ) {
  3184.             parseOK := TRUE
  3185.             If ( doit )
  3186.                f_MaxWindow( winID, "A", TRUE )
  3187.          }
  3188.       }
  3189.       Else If ( action = "pos1" ) {
  3190.          parseOK := TRUE
  3191.          If ( doit )
  3192.             f_PositionWindow( winID, args, TRUE )
  3193.       }
  3194.       Else If ( action = "min1" ) {
  3195.          parseOK := TRUE
  3196.          If ( doit ) {
  3197.             ; break from this loop and return "m2t"
  3198.             parseOK = m2t
  3199.             Break
  3200.          }
  3201.       }
  3202.       Else If ( action = "reg1" ) {
  3203.          ; write to registry
  3204.          ; we need exactly 4 arguments, separated by comma
  3205.          StringSplit, tmp, args, `,, %A_Space%%A_Tab%
  3206.          If ( tmp0 <> 4 )
  3207.             Return
  3208.          parseOK := TRUE
  3209.          If ( doit )
  3210.             RegWrite, %tmp1%, HKCU, %tmp2%, %tmp3%, %tmp4%
  3211.       }
  3212.       Else If ( action = "reg2" ) {
  3213.          ; delete a registry key
  3214.          ; we need exactly 2 arguments, separated by comma
  3215.          StringSplit, tmp, args, `,, %A_Space%%A_Tab%
  3216.          If ( tmp0 <> 2 )
  3217.             Return
  3218.          parseOK := TRUE
  3219.          If ( doit )
  3220.             RegDelete, HKCU, %tmp1%, %tmp2%
  3221.       }
  3222.       Else {
  3223.          ; no recognized action to perform
  3224.          If ( doit )
  3225.             Continue
  3226.       }
  3227.  
  3228.       If ( doit )
  3229.          Sleep, 100
  3230.  
  3231.       If ( Not parseOK )
  3232.          Break
  3233.    }
  3234.  
  3235.    Return parseOK
  3236. }
  3237.  
  3238. f_SetLanguage( role="" )
  3239. {  ; -------------------- localization starts here --------------------
  3240.    Global
  3241.    Static lang
  3242.  
  3243.    If ( lang = "" ) {
  3244.       ; set display format of time once
  3245.       FormatTime, versionDate, %versionDate%, ShortDate
  3246.  
  3247.       ; did user request a language?
  3248.       RegRead, lang, HKCU, %h_RegSubkey%\Misc, ForceLanguage
  3249.       If ( Not lang )   ; nope!
  3250.          StringRight, lang, A_Language, 2
  3251.       StringLower, lang, lang
  3252.       If lang in 07,de,de_de        ; = German (0407, 0807, 0c07 ...)
  3253.          lang = de
  3254.       Else If lang in 0c,fr,fr_fr ; = French (040c, 080c, 0c0c, 100c, 140c, 180c ...)
  3255.          lang = fr
  3256.       Else  ; default is English
  3257.          lang = en
  3258.    }
  3259.  
  3260.    ; first: set defaults
  3261.    ; --- English ---
  3262.    If ( role = "helper" ) {
  3263.       lng_ExitWithParamError     = Error: First parameter must be a number!
  3264.       lng_MenuMultiWin           = &List of minimized windows
  3265.       lng_MenuAssignHotkey       = &Hotkey for showing window(s)...
  3266.       lng_MenuClose              = &Close window(s)
  3267.       lng_MenuUnhide             = &Show window(s)
  3268.       lng_hClose1                = Do you really wanna close window(s) "
  3269.      lng_hClose2                = "?
  3270.       lng_ChangeNameSelector     = Please enter the custom name:
  3271.      lng_ChangeIconSelector     = Select an icon file for "
  3272.      lng_ChangeIconSelectorExt  = Icon files
  3273.      lng_ChangeIconMulti        = Select an icon for "
  3274.       lng_SetupUnhideKey         = Hotkey to show window(s)
  3275.       lng_SetupCustomName        = Assign custom name
  3276.       lng_SetupCustomIcon        = Assign custom icon.
  3277.       lng_SetupOnBKList          = Window is on BossKey list.
  3278.       lng_SetupShowOnTitleChange = Show window when title changes.
  3279.       lng_SetupSOTCRegEx         = Optional: Only if this Regular Expression matches:
  3280.      lng_SetupNoMinimize        = Minimize window immediately (skip task bar).
  3281.       lng_SetupOnSMList          = Window is on StartupMinimize list.
  3282.       lng_SetupEventTitleH       = TriggerActions
  3283.       lng_SetupEvent1            = TA1: After hiding window
  3284.       lng_SetupEvent2            = TA2: Before unhiding window
  3285.       lng_SetupEvent3            = TA3: Before closing window
  3286.       lng_SetupEvent4            = TA4: Before exiting helper
  3287.       lng_SetupEvent5            = TA5: After window title changed
  3288.       lng_SetupEvent6            = JTA: On StartupMinimize: Trigger these actions ONLY!`nLeave blank to execute the actions specified above.`n(Do turn on StartupMinimize globally and for this window, too.)
  3289.    }
  3290.    Else If ( role = "starter" ) {
  3291.       lng_No3BtnMouseMsg            = No mouse with at 3 buttons found. Mouse support disabled!
  3292.       lng_ExitWithRunningError   = Error: Min2Tray is already running!
  3293.       lng_ExitWithAHKError       = Error: Could not find file "AutoHotkey.exe"!
  3294.       lng_ExitWithLockError      = Error: Could not erase lock-file! Please erase file manually:
  3295.      lng_MenuAbout              = &About %lng_WindowTitle%
  3296.       lng_MenuRestoreOnly        = &Restore all windows
  3297.       lng_MenuQuitRestoreAll     = Restore &all && quit
  3298.       lng_MenuQuitOnly           = &Quit only
  3299.       lng_MenuBKEditList         = Edit &BossKey list
  3300.       lng_MenuSMEditList         = Edit &StartupMinimize list
  3301.       lng_PurgeListHint          = Clear an edit control to match any class or window title/ID.`n`n"Window title" can be any part of a window's title (i.e. "secret"). Regular Expressions are supported.`n"ID" must be the unique ID of a window (i.e. "0xe02fe", same as AHKs "ahk_id").`nTo check for different window titles or IDs, concatenate them using "|" (pipe-sign).`nExample for a valid window title/ID line: "help|0xe02fe|beat the boss|0xe02fe".
  3302.       lng_BKPurgeListTitle       = BossKey list
  3303.       lng_BKPurgeList            = Select a window to be edited or removed from BossKey list
  3304.       lng_BKPurgeListReq         = Continue to remove selected entry from BossKey list?
  3305.       lng_SMPurgeList            = Select a window to be edited or removed from StartupMinimize list
  3306.       lng_SMPurgeListTitle       = StartupMinimize list
  3307.       lng_SMPurgeListReq         = Continue to remove selected entry from StartupMinimize list?
  3308.       lng_TrayTitle              = %lng_WindowTitle%
  3309.       lng_About1                 = %lng_WindowTitle% v%versionString% (%versionDate%)
  3310.       lng_About2                 = Minimize windows to the tray area of taskbar as icons`nby pressing third mouse button or custom hotkey.`nAdditional features: BossKey, always-on-top, StartupMinimize,`nhorizontal or vertical maximizing and much more.
  3311.       lng_About3                 = Distributed under the terms of the GPLv3.`nCreated by Junyx / KTC^brain in June 2005.
  3312.       ;lng_About4                 = English translation by Junyx
  3313.       lng_SetupKey               = Hotkey to minimize window
  3314.       lng_SetupMButtonTitle      = Use third (middle) mouse button for minimizing?
  3315.       lng_SetupMButtonOpt0       = Nope!
  3316.       lng_SetupMButtonOpt1       = by clicking on titlebar [DEFAULT]
  3317.       lng_SetupMButtonOpt2       = by clicking (no matter where)
  3318.       lng_SetupBkMultiWin        = BossKey employs MultiWindows mode. [NO]
  3319.       lng_SetupBk2sMode          = Using BossKey enforces StealthMode (SM hotkey makes icons re-appear). [NO]
  3320.       lng_SetupStealthSessOnly   = StealthMode is current session only. [YES]
  3321.       lng_SetupForcedMode        = Always force min- or maximizing of window (ForcedMode). [NO]
  3322.       lng_SetupJaakonMode        = Always prompt for custom name if none is present. [NO]
  3323.       lng_SetupNoMinGlobal       = Immediately minimize ANY window to tray (do skip task bar). [NO]
  3324.       lng_SetupClick2Mode        = Tray icon will need double-click to show window again (single-click is default). [NO]
  3325.       lng_SetupNoErrorMsgsMode   = Do not show any error messages. [NO]
  3326.       lng_SetupBossKey           = BossKey
  3327.       lng_SetupBKAddMouse        = CTRL+SHIFT+third mouse button for adding/removing a window to/from BossKey list. [NO]
  3328.       lng_SetupBKListToggle      = Hotkey for adding/removing`na window to/from BossKey list
  3329.       lng_BKListToggleOn         = window added to BossKey list.
  3330.       lng_BKListToggleOff        = window removed from BossKey list.
  3331.       lng_SetupBKTitle           = Set BossKey mode
  3332.       lng_SetupBKOpt0            = Opt-Out  -  minimize all windows EXCEPT those from BossKey list [DEFAULT]
  3333.       lng_SetupBKOpt1            = Opt-In  -  minimize ONLY windows from BossKey list
  3334.       lng_SetupBKOpt2            = Topmost  -  minimize all windows EXCEPT the topmost (active) one
  3335.       lng_SetupStealthKey        = Hotkey for StealthMode toggle
  3336.       lng_SetupAOTKey            = Hotkey for always-on-top
  3337.       lng_SetupPrefsKey          = Hotkey to open this preferences window
  3338.       lng_SetupYMaxKey           = Hotkey for maximizing vertically
  3339.       lng_SetupXMaxKey           = Hotkey for maximizing horizontally
  3340.       lng_SetupNoBKey            = Hotkey for NoButtons toggle
  3341.       lng_SetupAOTSlider1        = Transparency for always-on-top [NO]:
  3342.       lng_SetupAOTSlider2        = Opaque
  3343.       lng_SetupAOTSlider3        = Transparent
  3344.       lng_SetupStartupTitle      = StartupMinimize
  3345.       lng_SetupStartupEnable     = StartupMinimize: Enable minimizing of certain windows upon start of Min2Tray. Active after restart. [NO]
  3346.       lng_SetupStartupTS1        = Time span:
  3347.      lng_SetupStartupTS2        = sec
  3348.       lng_SetupStartupIN1        = Interval:
  3349.      lng_SetupStartupIN2        = ms
  3350.       lng_SetupStartupHint       = Check within the given time span`nevery X milliseconds (interval)`nif an open window is to be minimized.`nStartupMinimize will be turned off`nwhen X seconds (time span) passed.
  3351.       lng_SetupEventEnable       = Globally enable TriggerActions. [NO]
  3352.       lng_SetupEventTitleBK      = TriggerActions for BossKey
  3353.       lng_SetupEventBK1          = BK1: Before BossKey minimizes windows
  3354.       lng_SetupEventBK2          = BK2: After BossKey minimized windows
  3355.    }
  3356.    Else {
  3357.       lng_AOTtraytip             = window is now always-on-top.
  3358.       lng_Postraytip             = custom position assigned.
  3359.       lng_AMaxtraytip            = window is now maximized.
  3360.       lng_AMaxNottraytip         = window could not be maximized.
  3361.       lng_YMaxtraytip            = window is now vertically maximized.
  3362.       lng_YMaxNottraytip         = window could not be vertically maximized.
  3363.       lng_XMaxtraytip            = window is now horizontally maximized.
  3364.       lng_XMaxNottraytip         = window could not be horizontally maximized.
  3365.       lng_NoBtraytip             = buttons (SysMenu) removed from titlebar of window.
  3366.       lng_ExitWithOSError        = Error: Wrong operating system. Need Windows NT or newer!
  3367.       lng_ExitWithVersionError   = Error: Need AutoHotkey.exe version %h_MinReqAHK% or newer!
  3368.       lng_WindowTitle            = Min2Tray
  3369.       lng_SetupOK                = &Apply
  3370.       lng_SetupCancel            = &Cancel
  3371.       lng_SetupRemove            = &Remove
  3372.       lng_SetupEdit              = &Edit
  3373.       lng_SetupClose             = &Close
  3374.       lng_MenuPrefs              = &Preferences...
  3375.       lng_SetupTitle             = Prefs - %lng_WindowTitle%
  3376.       lng_SetupHint              = Hint: Press DELETE on keyboard and confirm by clicking "%lng_SetupOK%" to clear a hotkey!
  3377.       lng_SetupInvalidHotkey1    = The following hotkey could not be assigned: "
  3378.      lng_SetupInvalidHotkey2    = ".`nPlease use a different hotkey or delete the hotkey!
  3379.       lng_SetupEventError        = The following action contains an error, please correct or delete it:
  3380.      lng_SetupEventHint1        = To trigger several actions, concatenate them using "|" (pipe-sign).`nRemove an action by clearing its edit control.`n`nSupported TriggerActions are:
  3381.      lng_SetupEventHint2        =
  3382.       ( LTrim
  3383.          key1:<keystrokes to send>
  3384.          `t- activate window and send simulated keystrokes
  3385.          `t- special chars: # = winkey; ^ = CTRL; ! = ALT; + = SHIFT
  3386.          key2:<delay,keystrokes to send>
  3387.          `t- activate window and send simulated keystrokes
  3388.          `t- you have to set the "typing"-delay here, too (in milliseconds)
  3389.          key4:<keystrokes to send>
  3390.          `t- send simulated keystrokes to window, not activating it
  3391.          `t- use this i.e. to send chars to "cmd.exe"
  3392.          key5:<control,keystrokes to send>
  3393.          `t- send simulated keystrokes to a specified control of window
  3394.          `t- i.e. for "notepad.exe": key5:Edit1,This is text in notepad.
  3395.          key6:<delay,control,keystrokes to send>
  3396.          `t- send simulated keystrokes to a specified control of window
  3397.          `t- you have to set the "typing"-delay here, too (in milliseconds)
  3398.          act1:<activate window>
  3399.          `t- activate the window bringing it to front
  3400.          `t- useful after execution of key4 or key5
  3401.          act2:<re-activate last activate window>
  3402.          `t- bring last activate and remembered window to front
  3403.          `t- i.e. after un-hiding BossKey-minimized windows
  3404.          aot1:<make window always-on-top>
  3405.          `t- the only accepted parameters are:
  3406.         `t   ON = make window always-on-top
  3407.          `t   OFF = remove always-on-top from window
  3408.          nob1:<NoButtons mode>
  3409.          `t- the only accepted parameters are:
  3410.         `t   ON = remove buttons (SysMenu) from titlebar of window
  3411.          `t   OFF = show buttons again
  3412.          max1:<maximize window>
  3413.          `t- the only accepted parameters are:
  3414.         `t   X = maximize window horizontally
  3415.          `t   Y = maximize window vertically
  3416.          `t   BOTH = maximize window in both directions
  3417.          pos1:<X,Y,W,H>
  3418.          `t- change position and/or size of window:
  3419.         `t   X,Y = upper left corner in pixels
  3420.          `t   W,H = width and height in pixels
  3421.          `t- any value is optional (include the commas!)
  3422.          `t- blank values are left untouched, i.e.:
  3423.          `t   pos1:20,,,400 = X is 20p from left and height is 400p
  3424.          `t   pos1:50,50 = set upper left corner to X=50p and Y=50p
  3425.          `t   pos1:,,800,200 = set window size to 800 x 200 pixels
  3426.          aud1:<manipulate master volume>
  3427.          `t- the only accepted parameters are:
  3428.         `t   MUTE_ON = mute the master volume
  3429.          `t   MUTE_OFF = unmute
  3430.          `t   MUTE_TOGGLE = toggle mute
  3431.          snd1:<path and filename>
  3432.          `t- play a soundfile (*.wav)
  3433.          `t- wait for it to finish
  3434.          snd2:<path and filename>
  3435.          `t- play a soundfile (*.wav)
  3436.          `t- do not wait for it to finish
  3437.          run1:<path and filename>
  3438.          `t- run a program
  3439.          `t- do not wait for it to finish
  3440.          run2:<path and filename>
  3441.          `t- run a program (try to hide its window)
  3442.          `t- do not wait for it to finish
  3443.          run3:<path and filename>
  3444.          `t- run a program, do not wait for it to finish
  3445.          `t- last command line parameter is ahk_id of window
  3446.          rnw1:<path and filename>
  3447.          `t- run a program
  3448.          `t- wait for it to finish
  3449.          rnw2:<path and filename>
  3450.          `t- run a program (try to hide its window)
  3451.          `t- wait for it to finish
  3452.          rnw3:<path and filename>
  3453.          `t- run a program, wait for it to finish
  3454.          `t- last command line parameter is ahk_id of window
  3455.          msg1:<any text you want>
  3456.          `t- display a message box with text
  3457.          `t- window has one OK button
  3458.          slp1:<delay>
  3459.          `t- time to pause (in milliseconds)
  3460.          `t- between 0 and 2147483647 (24 days)
  3461.          min1:<minimize this window>
  3462.          `t- stop further processing of actions and
  3463.          `t- do minimize this window right away
  3464.          stm1:<manipulate StealthMode>
  3465.          `t- the only accepted parameters are:
  3466.         `t   ON = enforce StealthMode (show no icons)
  3467.          `t   OFF = turn off StealthMode
  3468.          `t   TOGGLE = toggle mode
  3469.          reg1:<type,subkey,name,value>
  3470.          `t- write a value to the registry:
  3471.         `t   type: REG_SZ, REG_DWORD, REG_BINARY, REG_EXPAND_SZ
  3472.          `t         or REG_MULTI_SZ
  3473.          `t   subkey: key below HKEY_CURRENT_USER, e.g. Software\MyApp
  3474.          `t   name: name of value to write to, may be blank for "(Default)"
  3475.          `t   value: the value to be written depending on type
  3476.          reg2:<subkey,name>
  3477.          `t- delete a value from the registry:
  3478.         `t   subkey: key below HKEY_CURRENT_USER, e.g. Software\MyApp
  3479.          `t   name: the name of the value to delete
  3480.          cfw1:<manipulate CheckForWin timer>
  3481.          `t- INTERNAL USE ONLY! does break things badly!
  3482.          `t- valid only for TriggerAction of minimized window, not BossKey
  3483.          `t- timer periodically checks the state of the window
  3484.          `t- the only accepted parameters are:
  3485.         `t   OFF = pause CheckForWin timer
  3486.          `t   ON = un-pause timer (ALWAYS DO THIS!)
  3487.       )
  3488.    }
  3489.  
  3490.    ; second: localization begins
  3491.    If ( lang = "de" ) {
  3492.       ; --- German ---
  3493.       If ( role = "helper" ) {
  3494.          lng_ExitWithParamError     = Fehler: Keine Nummer als erster Parameter übergeben!
  3495.          lng_MenuMultiWin           = &Liste der minimierten Fenster
  3496.          lng_MenuAssignHotkey       = &Hotkey zum Fenster-Anzeigen...
  3497.          lng_MenuClose              = &Schließe Fenster
  3498.          lng_MenuUnhide             = &Zeige Fenster
  3499.          lng_hClose1                = Wollen Sie das Fenster "
  3500.         lng_hClose2                = " wirklich schließen?
  3501.          lng_ChangeNameSelector     = Geben Sie bitte den neuen Namen ein:
  3502.         lng_ChangeIconSelector     = Wählen Sie eine Icon-Datei aus für "
  3503.         lng_ChangeIconSelectorExt  = Icon-Dateien
  3504.         lng_ChangeIconMulti        = Wählen Sie ein Icon aus für "
  3505.          lng_SetupUnhideKey         = Hotkey zum Fenster zeigen
  3506.          lng_SetupCustomName        = Weise eigenen Name zu
  3507.          lng_SetupCustomIcon        = Weise eigenes Icon zu.
  3508.          lng_SetupOnBKList          = Fenster ist auf BossKey-Liste.
  3509.          lng_SetupShowOnTitleChange = Zeige Fenster bei geändertem Titel.
  3510.          lng_SetupSOTCRegEx         = Optional: Nur wenn diese Regular Expression zutrifft:
  3511.         lng_SetupNoMinimize        = Minimiere sofort (übergehe Taskbar).
  3512.          lng_SetupOnSMList          = Fenster ist auf StartupMinimize-Liste.
  3513.          lng_SetupEventTitleH       = TriggerActions
  3514.          lng_SetupEvent1            = TA1: Nach Minimieren des Fensters
  3515.          lng_SetupEvent2            = TA2: Vor Wiederanzeige des Fensters
  3516.          lng_SetupEvent3            = TA3: Vor Schließen des Fensters
  3517.          lng_SetupEvent4            = TA4: Vor Beenden des Tray-Icons (Helfer)
  3518.          lng_SetupEvent5            = TA5: Nach Änderung des Fenster-Titels
  3519.          lng_SetupEvent6            = JTA: Bei StartupMinimize: NUR diese Aktionen ausführen!`nLeer lassen zum Ausführen der oben angegebenen Aktionen.`n(StartupMinimize muss dafür global und für dieses Fenster angeschaltet sein.)
  3520.       }
  3521.       Else If ( role = "starter" ) {
  3522.          lng_No3BtnMouseMsg         = Keine Maus mit 3 Knöpfen gefunden. Mausunterstützung abgeschaltet!
  3523.          lng_ExitWithRunningError   = Fehler: Min2Tray wurde schon einmal gestartet!
  3524.          lng_ExitWithAHKError       = Fehler: Konnte Datei "AutoHotkey.exe" nicht ausfindig machen!
  3525.          lng_ExitWithLockError      = Fehler: Konnte Lockfile nicht löschen. Bitte Datei von Hand löschen:
  3526.         lng_MenuAbout              = &Über %lng_WindowTitle%
  3527.          lng_MenuRestoreOnly        = &Alle Fenster wiederherstellen
  3528.          lng_MenuQuitRestoreAll     = &Wiederherstellen && beenden
  3529.          lng_MenuQuitOnly           = Nur &Beenden
  3530.          lng_MenuBKEditList         = &BossKey-Liste bearbeiten
  3531.          lng_MenuSMEditList         = &StartupMinimize-Liste bearbeiten
  3532.          lng_PurgeListHint          = Eingabefeld löschen, um beliebige Klassen ("class") oder Fenstertitel/ID ("window title") zu erfassen.`n`n"Window title" kann jeder Teil des Titels eines Fensters sein (z.B. "secret"). Regular Expressions werden unterstüzt.`n"ID" muss die eindeutige ID eines Fensters sein (z.B. "0xe02fe", ist gleich AutoHotkeys "ahk_id").`nUm auf verschiedene Fenstertitel oder IDs zu testen, müssen diese mit "|" (Pipe-Zeichen) verbunden werden.`nBeispiel einer gültigen Fenstertitel/ID-Zeile: "help|0xe02fe|beat the boss|0xe02fe".
  3533.          lng_BKPurgeListTitle       = BossKey-Liste
  3534.          lng_BKPurgeList            = Fenster markieren zum Bearbeiten oder Entfernen von der BossKey-Liste
  3535.          lng_BKPurgeListReq         = Soll der markierte Eintrag aus der BossKey-Liste gelöscht werden?
  3536.          lng_SMPurgeList            = Fenster markieren zum Bearbeiten oder Entfernen von der StartupMinimize-Liste
  3537.          lng_SMPurgeListTitle       = StartupMinimize-Liste
  3538.          lng_SMPurgeListReq         = Soll der markierte Eintrag aus der StartupMinimize-Liste gelöscht werden?
  3539.          lng_TrayTitle              = %lng_WindowTitle%
  3540.          lng_About1                 = %lng_WindowTitle% v%versionString% (%versionDate%)
  3541.          lng_About2                 = Minimiert Fenster in den Tray-Bereich der Taskbar als kleine Icons.`nDazu den dritten Mausknopf bzw. den benutzerdefinierten Hotkey drücken.`nWeitere Funktionalitäten: BossKey, Always-on-top, StartupMinimize,`nhorizontales bzw. vertikales Maximieren und einiges mehr.
  3542.          lng_About3                 = Vertrieben unter den Auflagen der GPLv3.`nErstellt von Junyx / KTC^brain im Juni 2005.
  3543.          lng_SetupKey               = Hotkey zum Fenster minimieren
  3544.          lng_SetupMButtonTitle      = Dritte (mittlere) Maustaste zum Minimieren nutzen?
  3545.          lng_SetupMButtonOpt0       = Kein Bedarf!
  3546.          lng_SetupMButtonOpt1       = durch Klicken auf Titelleiste [STANDARD]
  3547.          lng_SetupMButtonOpt2       = durch Klicken (egal wohin)
  3548.          lng_SetupBkMultiWin        = BossKey setzt MultiWindows-Mode ein. [NEIN]
  3549.          lng_SetupBk2sMode          = BossKey-Nutzung erzwingt StealthMode (SM-Hotkey blendet Icons wieder ein). [NEIN]
  3550.          lng_SetupStealthSessOnly   = StealthMode nur für aktuelle Sitzung. [JA]
  3551.          lng_SetupForcedMode        = Erzwinge immer Min- bzw. Maximierung des Fensters (ForcedMode). [NEIN]
  3552.          lng_SetupJaakonMode        = Frage immer nach einem "Eigenen Name", wenn noch keiner vergeben wurde. [NEIN]
  3553.          lng_SetupNoMinGlobal       = Minimiere JEDES Fenster sofort ins Tray (übergehe Taskbar). [NEIN]
  3554.          lng_SetupClick2Mode        = Tray-Icon benötigt Doppelklick um Fenster wieder anzuzeigen (sonst Einfachklick). [NEIN]
  3555.          lng_SetupNoErrorMsgsMode   = Keinerlei Fehlermeldungen anzeigen. [NEIN]
  3556.          lng_SetupBossKey           = BossKey
  3557.          lng_SetupBKAddMouse        = STRG+UMSCHALT+dritte Maustaste zum Hinzufügen/Entfernen eines Fensters zu/von der BossKey-Liste. [NEIN]
  3558.          lng_SetupBKListToggle      = Hotkey zum Hinzufügen/Entfernen`neines Fensters zu/von der BossKey-Liste
  3559.          lng_BKListToggleOn         = Fenster zur BossKey-Liste hinzugefügt.
  3560.          lng_BKListToggleOff        = Fenster von BossKey-Liste entfernt.
  3561.          lng_SetupBKTitle           = BossKey-Modus bestimmen
  3562.          lng_SetupBKOpt0            = Opt-Out  -  minimiere alle Fenster AUSSER die der BossKey-Liste [STANDARD]
  3563.          lng_SetupBKOpt1            = Opt-In  -  minimiere NUR Fenster der BossKey-Liste
  3564.          lng_SetupBKOpt2            = Topmost  -  minimiere alle Fenster AUSSER das oberste (aktive)
  3565.          lng_SetupStealthKey        = Hotkey für StealthMode Umschaltung
  3566.          lng_SetupAOTKey            = Hotkey für Always-On-Top
  3567.          lng_SetupPrefsKey          = Hotkey zum Öffnen dieses Einstellungsfensters
  3568.          lng_SetupYMaxKey           = Hotkey für vertikales Maximieren
  3569.          lng_SetupXMaxKey           = Hotkey für horizontales Maximieren
  3570.          lng_SetupNoBKey            = Hotkey für NoButtons Umschaltung
  3571.          lng_SetupAOTSlider1        = Transparenz für Always-On-Top [NEIN]:
  3572.          lng_SetupAOTSlider2        = Opak
  3573.          lng_SetupAOTSlider3        = Transparent
  3574.          lng_SetupStartupTitle      = StartupMinimize
  3575.          lng_SetupStartupEnable     = StartupMinimize: Minimiere bestimmte Fenster bei jedem Start von Min2Tray automatisch. Aktiv nach Neustart. [NEIN]
  3576.          lng_SetupStartupTS1        = Zeitspanne:
  3577.         lng_SetupStartupTS2        = Sekunden
  3578.          lng_SetupStartupIN1        = Intervall:
  3579.         lng_SetupStartupIN2        = ms
  3580.          lng_SetupStartupHint       = Prüfe innerhalb der gegebenen Zeitspanne jeweils`nnach den spezifizierten Millisekunden (Intervall),`nob ein offenes Fenster zu minimieren ist.`nNach Ablauf der Zeitspanne wird "StartupMinimize"`nabgeschaltet.
  3581.          lng_SetupEventEnable       = Schalte TriggerActions global ein. [NEIN]
  3582.          lng_SetupEventTitleBK      = TriggerActions für BossKey
  3583.          lng_SetupEventBK1          = BK1: Bevor BossKey die Fenster minimiert
  3584.          lng_SetupEventBK2          = BK2: Nachdem BossKey die Fenster minimiert hat
  3585.       }
  3586.       Else {
  3587.          lng_AOTtraytip             = Fenster ist nun immer im Vordergrund.
  3588.          lng_Postraytip             = Benutzerdefinierte Position zugewiesen.
  3589.          lng_AMaxtraytip            = Fenster wurde maximiert.
  3590.          lng_AMaxNottraytip         = Fenster konnte nicht maximiert werden.
  3591.          lng_YMaxtraytip            = Fenster wurde vertikal maximiert.
  3592.          lng_YMaxNottraytip         = Fenster konnte nicht vertikal maximiert werden.
  3593.          lng_XMaxtraytip            = Fenster wurde horizontal maximiert.
  3594.          lng_XMaxNottraytip         = Fenster konnte nicht horizontal maximiert werden.
  3595.          lng_NoBtraytip             = Knöpfe (SysMenu) von Titelleiste des Fensters entfernt.
  3596.          lng_ExitWithOSError        = Fehler: Falsches Betriebssystem. Benötige Windows NT und höher!
  3597.          lng_ExitWithVersionError   = Fehler: Benötige "AutoHotkey.exe" Version %h_MinReqAHK% oder höher!
  3598.          lng_WindowTitle            = Min2Tray
  3599.          lng_SetupOK                = Ü&bernehmen
  3600.          lng_SetupCancel            = &Abbrechen
  3601.          lng_SetupRemove            = &Entfernen
  3602.          lng_SetupClose             = &Schließen
  3603.          lng_SetupEdit              = &Bearbeiten
  3604.          lng_MenuPrefs              = &Einstellungen...
  3605.          lng_SetupTitle             = Einstellungen - %lng_WindowTitle%
  3606.          lng_SetupHint              = Hinweis: Drücken Sie ENTFERNEN und bestätigen Sie mit "%lng_SetupOK%", um einen Hotkey zu löschen!
  3607.          lng_SetupInvalidHotkey1    = Folgender Hotkey konnte nicht zugewiesen werden: "
  3608.         lng_SetupInvalidHotkey2    = ".`nBitte anderen Hotkey wählen oder den Hotkey entfernen!
  3609.          lng_SetupEventError        = Die folgende Aktion enthält einen Fehler, bitte korrigieren oder löschen:
  3610.         lng_SetupEventHint1        = Eingabefeld löschen, um die angegebenen Aktionen zu entfernen.`nUm mehrere Aktionen auszulösen, müssen diese mit "|" (Pipe-Zeichen) verbunden werden.`n`nUnterstützt werden folgende Aktionen:
  3611.         lng_SetupEventHint2        =
  3612.          ( LTrim
  3613.             key1:<zu sendende Tastendrücke>
  3614.             `t- aktiviere Fenster und sende simulierte Tastendrücke
  3615.             `t- Spezialzeichen: # = WIN; ^ = STRG; ! = ALT; + = UMSCHALT
  3616.             key2:<Verzögerung,zu sendende Tastendrücke>
  3617.             `t- aktiviere Fenster und sende simulierte Tastendrücke
  3618.             `t- Tastenverzögerung muss angegeben werden (in Millisekunden)
  3619.             key4:<zu sendende Tastendrücke>
  3620.             `t- sende Tastendrücke ans Fenster, ohne es zu aktivieren
  3621.             `t- nutze dies z.B. um Zeichen an "cmd.exe" zu senden
  3622.             key5:<Control,zu sendende Tastendrücke>
  3623.             `t- sende Tastendrücke an ein spezielles Control des Fensters
  3624.             `t- z.B. für "notepad.exe": key5:Edit1,Das ist Text im Editor.
  3625.             key6:<Verzögerung,Control,zu sendende Tastendrücke>
  3626.             `t- sende Tastendrücke an ein spezielles Control des Fensters
  3627.             `t- Tastenverzögerung muss angegeben werden (in Millisekunden)
  3628.             act1:<aktiviere Fenster>
  3629.             `t- aktiviere das Fenster und bringe es damit nach vorn
  3630.             `t- nützlich nach Ausführung von key4, key5 oder key6
  3631.             act2:<reaktiviere zuletzt aktives Fenster>
  3632.             `t- zuletzt aktives und gemerktes Fenster nach vorn bringen
  3633.             `t- z.B. nach Wiederanzeige von BossKey-versteckten Fenstern
  3634.             aot1:<Always-On-Top Modus für ein Fenster>
  3635.             `t- nur folgende Parameter werden erkannt:
  3636.            `t   ON = Fenster im Vordergrund halten (Always-On-Top)
  3637.             `t   OFF = entferne Always-On-Top von Fenster
  3638.             nob1:<NoButtons Modus für ein Fenster>
  3639.             `t- nur folgende Parameter werden erkannt:
  3640.            `t   ON = Knöpfe (SysMenu) von Titelleiste des Fensters entfernt
  3641.             `t   OFF = zeige Knöpfe wieder in Titelleiste
  3642.             max1:<ein Fenster maximieren>
  3643.             `t- nur folgende Parameter werden erkannt:
  3644.            `t   X = Fenster horizontal maximieren
  3645.             `t   Y = Fenster vertikal maximieren
  3646.             `t   BOTH = Fenster in beide Richtungen maximieren
  3647.             pos1:<X,Y,W,H>
  3648.             `t- verändere Position und/oder Größe des Fensters:
  3649.            `t   X,Y = linke obere Ecke in Pixel
  3650.             `t   W,H = Breite und Höhe in Pixel
  3651.             `t- jeder Wert ist optional (Kommas aber einfügen!)
  3652.             `t- leere Wertangaben bleiben unberührt, z.B.:
  3653.             `t   20,,,400 = X ist 20p von links und Höhe ist 400p
  3654.             `t   50,50 = setze linke obere Ecke auf X=50p und Y=50p
  3655.             `t   ,,800,200 = setze Fenstergröße auf 800 x 200 Pixel
  3656.             aud1:<beeinflusse System-Lautstärkeregler>
  3657.             `t- nur folgende Parameter werden erkannt:
  3658.            `t   MUTE_ON = Stummschaltung ein
  3659.             `t   MUTE_OFF = Stummschaltung aus
  3660.             `t   MUTE_TOGGLE = Stummschaltung umkehren
  3661.             snd1:<Pfad und Dateiname>
  3662.             `t- spiele eine Musikdatei ab (*.wav)
  3663.             `t- warte auf deren Ende
  3664.             snd2:<Pfad und Dateiname>
  3665.             `t- spiele eine Musikdatei ab (*.wav)
  3666.             `t- warte nicht auf deren Ende
  3667.             run1:<Pfad und Dateiname>
  3668.             `t- starte ein Programm
  3669.             `t- warte nicht auf Programmende
  3670.             run2:<Pfad und Dateiname>
  3671.             `t- starte ein Programm (Fenster wird versteckt)
  3672.             `t- warte nicht auf Programmende
  3673.             run3:<Pfad und Dateiname>
  3674.             `t- starte ein Programm, warte nicht auf Programmende
  3675.             `t- letzter Kommandozeilenparameter ist ahk_id des Fensters
  3676.             rnw1:<Pfad und Dateiname>
  3677.             `t- starte ein Programm
  3678.             `t- warte auf Programmende
  3679.             rnw2:<Pfad und Dateiname>
  3680.             `t- starte ein Programm (Fenster wird versteckt)
  3681.             `t- warte auf Programmende
  3682.             rnw3:<path and filename>
  3683.             `t- starte ein Programm, warte auf Programmende
  3684.             `t- letzter Kommandozeilenparameter ist ahk_id des Fensters
  3685.             msg1:<beliebiger Text>
  3686.             `t- zeige Text in einem Dialogfenster an
  3687.             `t- Fenster hat einen OK-Knopf
  3688.             slp1:<Verzögerung>
  3689.             `t- Pause (in Millisekunden)
  3690.             `t- zwischen 0 und 2147483647 (24 Tage)
  3691.             min1:<minimiere dieses Fenster>
  3692.             `t- stoppe weitere Verarbeitung von Aktionen und
  3693.             `t- minimiere dieses Fenster sofort
  3694.             stm1:<beeinflusse StealthMode>
  3695.             `t- nur folgende Parameter werden erkannt:
  3696.            `t   ON = StealthMode einschalten (keine Icons anzeigen)
  3697.             `t   OFF = StealthMode ausschalten
  3698.             `t   TOGGLE = Modus umkehren
  3699.             reg1:<Typ,Unter,Name,Wert>
  3700.             `t- schreibe einen Wert in die Registry:
  3701.            `t   Typ: REG_SZ, REG_DWORD, REG_BINARY, REG_EXPAND_SZ
  3702.             `t         oder REG_MULTI_SZ
  3703.             `t   Unter: Schlüssel unter HKEY_CURRENT_USER, z.B. Software\MyApp
  3704.             `t   Name: zu beschreibender Wertname, kann leer sein für "(Standard)"
  3705.             `t   Wert: der zu schreibende Wert, abhängig vom Typ
  3706.             reg2:<Unter,Name>
  3707.             `t- lösche einen Wert aus der Registry:
  3708.            `t   Unter: Schlüssel unter HKEY_CURRENT_USER, z.B. Software\MyApp
  3709.             `t   Name: der zu löschende Wert
  3710.             cfw1:<verändere CheckForWin-Timer>
  3711.             `t- NUR FÜR INTERNE NUTZUNG! Lässt Min2Tray öfter abstürzen!
  3712.             `t- nur anwendbar für TriggerAction eines Fensters, nicht bei BossKey
  3713.             `t- der Timer überprüft periodisch den Status des minimierten Fensters
  3714.             `t- nur folgende Parameter werden erkannt:
  3715.            `t   OFF = halte den CheckForWin-Timer an
  3716.             `t   ON = starte den Timer wieder (IMMER NOTWENDIG!)
  3717.          )
  3718.       }
  3719.    }
  3720.    Else If ( lang = "fr" ) {
  3721.       ; --- French ---
  3722.       If ( role = "helper" ) {
  3723.          lng_ExitWithParamError     = Erreur: le 1er paramètre doit être un nombre !
  3724.          lng_MenuMultiWin           = &Liste des fenêtres minimisées
  3725.          lng_MenuAssignHotkey       = &Hotkey pour afficher la(les) fenêtre(s)
  3726.          lng_MenuClose              = &Ferme la(les) fenêtre(s)
  3727.          lng_MenuUnhide             = &Afficher la(les) fenêtre(s)
  3728.          lng_hClose1                = Voulez-vous vraiment fermer la(les) fenêtre(s) "
  3729.         lng_hClose2                = "?
  3730.          lng_ChangeNameSelector     = Entrez le nom personnalisé :
  3731.          lng_ChangeIconSelector     = Sélectionnez un fichier icône pour "
  3732.         lng_ChangeIconSelectorExt  = Fichiers icône
  3733.         lng_ChangeIconMulti        = Selectionnez une icône pour "
  3734.          lng_SetupUnhideKey         = Hotkey pour afficher la(les) fenêtre(s)
  3735.          lng_SetupCustomName        = Assigner un nom personnalisé
  3736.          lng_SetupCustomIcon        = Assigner une icône personnalisée.
  3737.          lng_SetupOnBKList          = Fenêtre sur la liste BossKey.
  3738.          lng_SetupShowOnTitleChange = Afficher la fenêtre quand le titre change.
  3739.          lng_SetupSOTCRegEx         = Facultatif: seulement si l'expression régulière correspond:
  3740.         lng_SetupNoMinimize        = Réduire la fenêtre immédiatement (ne pas mettre dans la barre des tâches).
  3741.          lng_SetupOnSMList          = Fenêtre sur la liste StartupMinimize.
  3742.          lng_SetupEventTitleH       = TriggerActions
  3743.          lng_SetupEvent1            = TA1: Après avoir caché la fenêtre
  3744.          lng_SetupEvent2            = TA2: Avant de cacher la fenêtre
  3745.          lng_SetupEvent3            = TA3: Avant de fermer la fenêtre
  3746.          lng_SetupEvent4            = TA4: Avant de quitter l'helper
  3747.          lng_SetupEvent5            = TA5: Après que le titre de la fenêtre ait changé
  3748.          lng_SetupEvent6            = JTA: On StartupMinimize: SEULEMENT déclencher ces actions!`nLaissez vide pour exécuter les actions spécifiés au dessus.`n(Activez StartupMinimize globallement et pour cette fenêtre également.)
  3749.       }
  3750.       Else If ( role = "starter" ) {
  3751.          lng_No3BtnMouseMsg         = Pas de souris 3 boutons trouvée. Gestion de la souris absente !
  3752.          lng_ExitWithRunningError   = Erreur: Min2Tray fonctionne déjà !
  3753.          lng_ExitWithAHKError       = Erreur: "AutoHotkey.exe" introuvable !
  3754.          lng_ExitWithLockError      = Erreur: Ne peut effacer le fichier lock ! L'effacer manuellement :
  3755.          lng_MenuAbout              = &A propos de %lng_WindowTitle%
  3756.          lng_MenuRestoreOnly        = &Restaurer toutes les fenêtres
  3757.          lng_MenuQuitRestoreAll     = Restaurer &toutes les fenêtres && quitter
  3758.          lng_MenuQuitOnly           = &Quitter
  3759.          lng_MenuBKEditList         = Editer la liste des fenêtres &BossKey
  3760.          lng_MenuSMEditList         = Editer la liste &StartupMinimize
  3761.          lng_PurgeListHint          = Videz la zone d'édition pour trouver n'importe quelle classe ou titre de fenêtre/ID.`n`n"Titre de fenêtre" peut être un sous-ensemble du titre d'une fenêtre (c.a.d. "secret"). Des expressions régulières sont soutenues.`n"ID" doit être l'identifiant unique d'une fenêtre (c.a.d. "0xe02fe", identique aux "ahk_id" d'AHK).`nPour vérifier différents titres de fenêtre ou IDs, concatenez les avec un "|" (signe pipe).`nExample de ligne correcte: "help|0xe02fe|beat the boss|0xe02fe".
  3762.          lng_BKPurgeListTitle       = Liste des fenêtres BossKey
  3763.          lng_BKPurgeList            = Sélectionner une fenêtre à éditer ou enlever de la liste BossKey
  3764.          lng_BKPurgeListReq         = Enlever l'entrée sélectionnée de la liste BossKey?
  3765.          lng_SMPurgeList            = Sélectionner une fenêtre à éditer ou enlever de la liste StartupMinimize
  3766.          lng_SMPurgeListTitle       = Liste StartupMinimize
  3767.          lng_SMPurgeListReq         = Enlever l'entrée sélectionnée de la liste StartupMinimize?
  3768.          lng_TrayTitle              = %lng_WindowTitle%
  3769.          lng_About1                 = %lng_WindowTitle% v%versionString% (%versionDate%)
  3770.          lng_About2                 = Réduit les fenêtres dans la zone de notification de la barre des tâches sous forme d'icônes`nen appuyant sur le troisième bouton de souris ou une touche de raccourci personalisée.`nFonctionnalités supplémentaires: BossKey, Toujours au dessus, StartupMinimize,`nAgrandissement horizontal ou vertical et bien plus encore.
  3771.          lng_About3                 = Distribué sous licence GPLv3.`nCréé par Junyx / KTC^brain en juin 2005.
  3772.          lng_About4                 = Traduction française par des Demokos et des Andreone.
  3773.          lng_SetupKey               = Hotkey pour réduire la fenêtre
  3774.          lng_SetupMButtonTitle      = Utiliser le 3ème bouton de la souris pour réduire?
  3775.          lng_SetupMButtonOpt0       = Non!
  3776.          lng_SetupMButtonOpt1       = en cliquant sur la barre de titre [DEFAUT]
  3777.          lng_SetupMButtonOpt2       = en cliquant n'importe où dans la fenêtre
  3778.          lng_SetupBkMultiWin        = BossKey utilise le mode MultiWindows. [NON]
  3779.          lng_SetupBk2sMode          = BossKey utilise le mode StealthMode (SM hotkey fait réapparaître les fenêtres). [NON]
  3780.          lng_SetupStealthSessOnly   = StealthMode seulement pour cette session. [OUI]
  3781.          lng_SetupForcedMode        = Force toujours min/maximisation d'une fenêtre (ForcedMode). [NON]
  3782.          lng_SetupJaakonMode        = Demande toujours nom personnalisé s'il n'y en a pas. [NON]
  3783.          lng_SetupClick2Mode        = Tray icon will need double-click to show window again (single-click is default). [NO]
  3784.          lng_SetupNoErrorMsgsMode   = Ne montrer aucun message d'erreur. [NON]
  3785.          lng_SetupBossKey           = BossKey
  3786.          lng_SetupBKAddMouse        = CTRL+SHIFT+3ème bouton de la souris pour ajouter/enlever une fenêtre à/de la liste BossKey. [NON]
  3787.          lng_SetupBKListToggle      = Hotkey pour ajouter/enlever`nune fenêtre à/de la liste BossKey
  3788.          lng_BKListToggleOn         = fenêtre ajoutée à la liste BossKey.
  3789.          lng_BKListToggleOff        = fenêtre enlevée de la liste BossKey.
  3790.          lng_SetupBKTitle           = Définis le mode BossKey
  3791.          lng_SetupBKOpt0            = Opt-Out  -  réduire toutes les fenêtres sauf celles de la liste BossKey [DEFAUT]
  3792.          lng_SetupBKOpt1            = Opt-In  -  réduire SEULEMENT les fenêtres de la liste BossKey
  3793.          lng_SetupBKOpt2            = Topmost  -  rduire TOUTES les fentres SAUF celle active
  3794.          lng_SetupStealthKey        = Hotkey pour StealthMode on/off
  3795.          lng_SetupAOTKey            = Hotkey pour toujours au-dessus
  3796.          lng_SetupYMaxKey           = Hotkey pour agrandir verticallement
  3797.          lng_SetupXMaxKey           = Hotkey pour agrandir horizontallement
  3798.          lng_SetupNoBKey            = Hotkey pour la fonction NoButtons
  3799.          lng_SetupAOTSlider1        = Transparence pour toujours au-dessus [NON]:
  3800.          lng_SetupAOTSlider2        = Opaques
  3801.          lng_SetupAOTSlider3        = Transparent
  3802.          lng_SetupStartupTitle      = StartupMinimize
  3803.          lng_SetupStartupEnable     = StartupMinimize: autorise la réduction de certaines fenêtres au démarrage de Min2Tray. Nécessite un redémarrage. [NON]
  3804.          lng_SetupStartupTS1        = Durée:
  3805.          lng_SetupStartupTS2        = sec
  3806.          lng_SetupStartupIN1        = Intervalle:
  3807.         lng_SetupStartupIN2        = ms
  3808.          lng_SetupStartupHint       = Vérifier toutes les X milliseconds (intervalle)`nsi une fenêtre ouverte doit être réduite.`nStartupMinimize sera désactivé`nlosque X secondes (durée) se seront écoulées.
  3809.          lng_SetupEventEnable       = Activer globalement les TriggerActions. [NON]
  3810.          lng_SetupEventTitleBK      = TriggerActions pour BossKey
  3811.          lng_SetupEventBK1          = BK1: Avant que la BossKey réduise les fenêtres
  3812.          lng_SetupEventBK2          = BK2: Après que la BossKey ait réduit les fenêtres
  3813.       }
  3814.       Else {
  3815.          lng_AOTtraytip             = Fenêtre en mode toujours au-dessus.
  3816.          lng_Postraytip             = position personalisée assignée.
  3817.          lng_AMaxtraytip            = la fenêtre est maintenant agrandie.
  3818.          lng_AMaxNottraytip         = la fenêtre ne peut être agrandie.
  3819.          lng_YMaxtraytip            = Fenêtre maximisée verticalement.
  3820.          lng_YMaxNottraytip         = La fenêtre ne peut être maximisée verticalement.
  3821.          lng_XMaxtraytip            = la fenêtre est maintenant agrandie horizontallement.
  3822.          lng_XMaxNottraytip         = la fenêtre ne peut être agrandie horizontallement.
  3823.          lng_NoBtraytip             = tous les boutons sont retirés de la barre de titre.
  3824.          lng_ExitWithOSError        = Erreur: Système d'exploitation incompatible. Nécessite Windows NT ou supérieur !
  3825.          lng_ExitWithVersionError   = Erreur: Nécessite AutoHotkey.exe version %h_MinReqAHK% ou supérieur !
  3826.          lng_WindowTitle            = Min2Tray
  3827.          lng_SetupOK                = &Appliquer
  3828.          lng_SetupCancel            = &Annuler
  3829.          lng_SetupRemove            = &Retirer
  3830.          lng_SetupEdit              = &Editer
  3831.          lng_SetupClose             = &Fermer
  3832.          lng_MenuPrefs              = &Préférences...
  3833.          lng_SetupTitle             = Prefs - %lng_WindowTitle%
  3834.          lng_SetupHint              = Astuce : Cliquez sur Suppr sur le clavier et confirmez en cliquant "%lng_SetupOK%" pour supprimer une hotkey !
  3835.          lng_SetupInvalidHotkey1    = La hotkey suivante ne peut être assignée : "
  3836.         lng_SetupInvalidHotkey2    = ".`nUtiliez une hotkey différente ou supprimez-la SVP !
  3837.          lng_SetupEventError        = L'action suivante contient une erreur, corrigez la ou supprimez la SVP :
  3838.          lng_SetupEventHint1        = Pour déclencher plusieurs actions, concaténez les avec un "|" (signe pipe).`nSupprimez une action en effaçant sa zone d'édition.`n`nLes TriggerActions sont:
  3839.         lng_SetupEventHint2        =
  3840.          ( LTrim
  3841.             key1:<touches à envoyer>
  3842.             `t- activer la fenêtre et envoyer des touches simulées
  3843.             `t- caractères speciaux: # = winkey; ^ = CTRL; ! = ALT; + = SHIFT
  3844.             key2:<temporisation,touches à envoyer>
  3845.             `t- activer la fenêtre et envoyer des touches simulées
  3846.             `t- vous devez précisier un "temps de frappe" (en millisecondes)
  3847.             key4:<touches à envoyer>
  3848.             `t- envoyer des touches simulées à une fenêtre, sans l'activer
  3849.             `t- à utiliser pour envoyer des caractères à "cmd.exe"
  3850.             key5:<contrôle,touches à envoyer>
  3851.             `t- envoyer des touches simulées à un contrôle d'une fenêtre
  3852.             `t- c.a.d. pour "notepad.exe": key5:Edit1,Ceci est du texte dans notepad.
  3853.             key6:<temporisation,contrôle,touches à envoyer>
  3854.             `t- envoyer des touches simulées à un contrôle d'une fenêtrew
  3855.             `t- vous devez précisier un "temps de frappe" (en millisecondes)
  3856.             act1:<activer le fenêtre>
  3857.             `t- activer la fenêtre en la mettant aupremier plan
  3858.             `t- utile après l'exécution de key4, key5 ou key6
  3859.             act2:<re-activate last activate window>
  3860.             `t- bring last activate and remembered window to front
  3861.             `t- i.e. after un-hiding BossKey-minimized windows
  3862.             aot1:<mettre la fenêtre au premier plan>
  3863.             `t- les seuls paramètres acceptés sont:
  3864.            `t   ON = mettre la fenêtre au premier plan
  3865.             `t   OFF = retirer la fenêtre du premier plan
  3866.             nob1:<Mode NoButtons>
  3867.             `t- les seuls paramètres acceptés sont:
  3868.            `t   ON = enlever les boutons (SysMenu) de titlebar de la fenêtre
  3869.             `t   OFF = montrer les boutons encore
  3870.             max1:<Agrandir la fenêtre>
  3871.             `t- les seuls paramètres acceptés sont:
  3872.            `t   X = agrandir la fenêtre horizontallement
  3873.             `t   Y = agrandir la fenêtre verticallement
  3874.             `t   BOTH = agrandir la fenêtre dans les deux directions
  3875.             pos1:<X,Y,W,H>
  3876.             `t- changer la position et/ou la taille d'une fenêtre:
  3877.            `t   X,Y = coin haut gauche en pixels
  3878.             `t   W,H = largeur et hauteur in pixels
  3879.             `t- toutes les valeurs sont facultatives (mettez les virgules!)
  3880.             `t- les valeurs vides ne sont pas modifiés, c.a.d.:
  3881.             `t   20,,,400 = X est 20p depuis la gauche et hauteur est 400p
  3882.             `t   50,50 = positionner le coin haut gauche à X=50p et Y=50p
  3883.             `t   ,,800,200 = changer la taille de la fenêtre à 800 x 200 pixels
  3884.             aud1:<changer le son principal>
  3885.             `t- les seuls paramètres acceptés sont:
  3886.            `t   MUTE_ON = couper le son principal
  3887.             `t   MUTE_OFF = annuler couper le son
  3888.             `t   MUTE_TOGGLE = permuter entre MUTE_ON et MUTE_OFF
  3889.             snd1:<chemin complet du fichier>
  3890.             `t- jouer un fichier son (*.wav)
  3891.             `t- attendre qu'il se termine
  3892.             snd2:<chemin complet du fichier>
  3893.             `t- jouer un fichier son (*.wav)
  3894.             `t- ne pas attendre qu'il se termine
  3895.             run1:<chemin complet du fichier>
  3896.             `t- exécuter un programme
  3897.             `t- ne pas attendre qu'il se termine
  3898.             run2:<chemin complet du fichier>
  3899.             `t- exécuter un programme (et essayer de cacher sa fenêtre)
  3900.             `t- ne pas attendre qu'il se termine
  3901.             run3:<chemin complet du fichier>
  3902.             `t- exécuter un programme, ne pas attendre qu'il se termine
  3903.             `t- la dernière ligne de commande paramètre est ahk_id de fenêtre
  3904.             rnw1:<chemin complet du fichier>
  3905.             `t- exécuter un programme
  3906.             `t- attendre qu'il se termine
  3907.             rnw2:<chemin complet du fichier>
  3908.             `t- exécuter un programme (et essayer de cacher sa fenêtre)
  3909.             `t- attendre qu'il se termine
  3910.             rnw3:<chemin complet du fichier>
  3911.             `t- exécuter un programme, attendre qu'il se termine
  3912.             `t- la dernière ligne de commande paramètre est ahk_id de fenêtre
  3913.             msg1:<n'importe quel texte>
  3914.             `t- afficher une boîte de message avec du texte
  3915.             `t- la fenêtre a un bouton OK
  3916.             slp1:<délai>
  3917.             `t- durée de la pause (en millisecondes)
  3918.             `t- entre 0 et 2147483647 (24 jours)
  3919.             min1:<réduire cette fenêtre>
  3920.             `t- arrêter les prochaines actions et
  3921.             `t- réduire cette fenêtre immédiatement
  3922.             stm1:<manipuler StealthMode>
  3923.             `t- les seuls paramtres accepts sont:
  3924.            `t   ON = activer StealthMode (ne montre aucun icne)
  3925.             `t   OFF = dsactiver StealthMode
  3926.             `t   TOGGLE = permuter le mode entre ON et OFF
  3927.             reg1:<type,subkey,name,value>
  3928.             `t- crire une valeur dans la base de registre:
  3929.            `t   type: REG_SZ, REG_DWORD, REG_BINARY, REG_EXPAND_SZ
  3930.             `t         or REG_MULTI_SZ
  3931.             `t   subkey: le nom de la clef sous HKEY_CURRENT_USER, c.a.d. Software\MyApp
  3932.             `t   name: le nom de la valeur  crire, peut tre laisse vide pour "(Default)"
  3933.             `t   value: la valeur  crire
  3934.             reg2:<subkey,name>
  3935.             `t- supprimer une valeur de la base de registre:
  3936.            `t   subkey: le nom de la clef sous HKEY_CURRENT_USER, c.a.d. Software\MyApp
  3937.             `t   name: le nom de la valeur  supprimer
  3938.             cfw1:<changer le timer CheckForWin>
  3939.             `t- USAGE INTERNE SEULEMENT! peut empêcher le bon fonctionnement!
  3940.             `t- valide seulement pour les TriggerAction des fenêtres réduites, pas BossKey
  3941.             `t- le timer vérifie périodiquement l'état de la fenêtre
  3942.             `t- les seuls paramètres acceptés sont:
  3943.            `t   OFF = mettre en pause le timer CheckForWin
  3944.             `t   ON = réactiver le timer (A TOUJOURS FAIRE!)
  3945.          )
  3946.       }
  3947.    }
  3948.    ; assemble about string (with translator greets)
  3949.    lng_About = %lng_About1%`n`n%lng_About2%`n`n%lng_About3%`n
  3950.    If ( lng_About4 )
  3951.       lng_About = %lng_About%--`n%lng_About4%`n
  3952. }
  3953.  
  3954. ;EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement