Lorenzo501

Time Saver (Thunderbird snippets and XML)

Nov 13th, 2024 (edited)
9
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. Time Saver.ahk:
  2.  
  3. ********** AUTOMATION FEATURES **********
  4.  
  5. Open a network stream in VLC once you click "Copy Stream URL" in uTorrent.
  6. Assist the Chrome extension "Tabs Outliner" by making sure it has finished saving before getting closed.
  7. Assist the Thunderbird extension "KeepRunning" by moving the app so fast to the tray on startup, that you won't even see the window appear (auto-runs Thunderbird if the app exists).
  8. IMPORTANT: in Thunderbird enable "When Thunderbird is minimized, move it to the tray" and install extension "KeepRunning". And move script to: %UserProfile%\Downloads\AutoHotkey
  9. And after that go to `Task Scheduler > Action > Import Task...` and then use the XML file (those w/o Thunderbird can ofcourse run this script via the shell:Startup folder instead).
  10. Upgrade VLC by opening videos of specific folder(s) with aspect ratio 16:9, changing default settings just once; to enable and fix features, and to prevent repetition and annoyances.
  11. Showing a close btn in fullscreen when your cursor reaches the top-right corner and making the fullscreen controller immovable, centered at the bottom.
  12. Unhide taskbar in specific fullscreen window(s) and allow the cursor to move taskbar icons after the LButton has been pressed down for atleast 500 ms (to avoid moving them by mistake).
  13. Auto-close the annoying WinRAR and Software Ideas Modeler notifications.
  14. Unfocus the minimized uTorrent window at startup to prevent key presses from affecting it by accident.
  15. TIP: move script to: %UserProfile%\Downloads\AutoHotkey, after that go to `Task Scheduler > Action > Import Task...` and then use the XML file (the task makes this feature faster).
  16. Scroll namespace to top when nearby on VS edit control show event.
  17.  
  18.  
  19. tbl := CreateTaskbarList()
  20. thunderbirdWinEventHook := HookEvent(EVENT_OBJECT_CREATE, HandleCreatedThunderbirdEvent)
  21. try Run("thunderbird.exe",, "Max")
  22. catch
  23. DllCall("UnhookWinEvent", "Ptr", thunderbirdWinEventHook)
  24.  
  25. HookEvent(EVENT_OBJECT_CREATE, HandleCreatedVlcEvent)
  26. HookEvent(EVENT_OBJECT_REORDER, HandleReorderedVlcEvent)
  27. HookEvent(EVENT_SYSTEM_FOREGROUND, HandleActivatedWindowVlcEvent)
  28. HookEvent(EVENT_SYSTEM_FOREGROUND, HandleChangedFullscreenWinEvent)
  29. HookEvent(EVENT_OBJECT_SHOW, HandleChangedFullscreenWinEvent)
  30. HookEvent(EVENT_OBJECT_SHOW, HandleShowedNotificationEvent)
  31. fullscreenVlcCloseButtonMouseEventHook := PointerDeviceHook("Move|LButton Down", HandleFullscreenVlcCloseButtonMouseEvent, true)
  32.  
  33.  
  34. ManageVisualStudioEventHandlers() ; Has a loop, so keep this at the bottom
  35.  
  36. CreateTaskbarList()
  37. {
  38. iid_ITaskbarList := "{56FDF342-FD6D-11d0-958A-006097C9A090}" ; Interface id (iid)
  39. clsid_TaskbarList := "{56FDF344-FD6D-11d0-958A-006097C9A090}" ; Class id (clsid)
  40. tbl := ComObject(clsid_TaskbarList, iid_ITaskbarList) ; Creates the TaskbarList object
  41.  
  42. loop (10)
  43. {
  44. try ComCall(3, tbl) ; Calls tbl.HrInit(), which initializes the TaskbarList object
  45. catch
  46. Sleep(50)
  47. else
  48. break
  49. }
  50.  
  51. return tbl
  52. }
  53.  
  54. ; Allows Thunderbird to properly load b/c otherwise you'd have to click the taskbar icon twice to open it
  55. HandleCreatedThunderbirdEvent(hWinEventHook, event, hWnd, *)
  56. {
  57. static thunderbirdIsBeingLoaded := false
  58.  
  59. ; Most windowing functions that are given a pure HWND will also work while it's hidden
  60. try shouldExecute := WinGetClass(hWnd) = "MozillaWindowClass" && WinGetProcessName(hWnd) = "thunderbird.exe" && !thunderbirdIsBeingLoaded
  61.  
  62. if (shouldExecute ?? false)
  63. {
  64. thunderbirdIsBeingLoaded := true
  65. WinSetTransparent(0, hWnd)
  66. ComCall(5, tbl, "Ptr", hWnd) ; Calls tbl.DeleteTab(winId), which deletes a tab from the TaskbarList
  67. DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
  68.  
  69. loop (3)
  70. {
  71. ; Aborts if thunderbird does not have the configuration to be closed automatically (follow the instructions at the top of the script)
  72. if (!WinWaitClose(hWnd,, 10))
  73. {
  74. ProcessClose("thunderbird.exe")
  75.  
  76. return
  77. }
  78.  
  79. WinActivate(hWnd)
  80. WinMinimize(hWnd)
  81. }
  82.  
  83. Sleep(100)
  84. WinSetTransparent("Off", hWnd)
  85. ComCall(4, tbl, "Ptr", hWnd) ; Calls tbl.AddTab(winId), which adds a tab to the TaskbarList
  86. }
  87. }
  88.  
  89.  
  90. Time Saver.xml:
  91.  
  92. <?xml version="1.0" encoding="UTF-16"?>
  93. <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  94. <Triggers>
  95. <LogonTrigger>
  96. <Enabled>true</Enabled>
  97. </LogonTrigger>
  98. </Triggers>
  99. <Settings>
  100. <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
  101. <IdleSettings>
  102. <StopOnIdleEnd>false</StopOnIdleEnd>
  103. </IdleSettings>
  104. <AllowStartOnDemand>true</AllowStartOnDemand>
  105. <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
  106. <Priority>5</Priority>
  107. </Settings>
  108. <Actions Context="Author">
  109. <Exec>
  110. <Command>"%ProgramFiles%\AutoHotkey\v2\AutoHotkey.exe"</Command>
  111. <Arguments>"%UserProfile%\Downloads\AutoHotkey\Time Saver.ahk"</Arguments>
  112. <WorkingDirectory>%UserProfile%\Downloads\AutoHotkey</WorkingDirectory>
  113. </Exec>
  114. </Actions>
  115. </Task>
Comments
  • Lorenzo501
    5 days
    # text 1.58 KB | 0 0
    1. if the similar feature that I made for Outlook ever shows its window visibly loading for awhile at computer startup, then I'll need to use the commented code below:
    2. HandleCreatedOutlookEvent(hWinEventHook, event, hWnd, *)
    3. {
    4. static outlookIsBeingLoaded := false
    5.  
    6. ; Most windowing functions that are given a pure HWND will also work while it's hidden (dunno if it matters here but still)
    7. try shouldExecute := WinGetClass(hWnd) = "Olk Host" && !outlookIsBeingLoaded
    8.  
    9. if (shouldExecute ?? false)
    10. {
    11. outlookIsBeingLoaded := true
    12. WinSetTransparent(0, hWnd)
    13. ComCall(5, tbl, "Ptr", hWnd) ; Calls tbl.DeleteTab(winId), which deletes a tab from the TaskbarList
    14. DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
    15.  
    16. ; while (!WinExist("- Outlook ahk_exe olk.exe")) ; Minimum delay for the minimize to work
    17. ; WinSetTransparent(0, hWnd) ; Making Outlook temporarily transparent (multiple times because it doesn't always work)
    18.  
    19. ; WinSetTransparent(0, hWnd) ; Making Outlook temporarily transparent (again in case the loop above didn't already succeed)
    20. WinWait("- Outlook ahk_exe olk.exe") ; Minimum delay for the minimize to work
    21. Sleep(2000) ; Extra delay to make sure that outlook has fully loaded before minimizing it and then outlook won't have to load once the user activates it
    22. WinMinimize(hWnd)
    23. WinSetTransparent("Off", hWnd)
    24. ComCall(4, tbl, "Ptr", hWnd) ; Calls tbl.AddTab(winId), which adds a tab to the TaskbarList
    25. }
    26. }
  • Lorenzo501
    4 days (edited)
    # text 0.48 KB | 0 0
    1. Thunderbird does actually show a red dot on the system tray icon at computer startup to indicate unread emails. But you'd have to make a screenshot of the desktop and put it on an always-on-top HTA window, to reliably hide the white thunderbird window that appears at computer startup. However then you'd still have the issue sometimes where you need to click the taskbar icon twice before it actually opens. My workaround for that wasn't reliable and I couldn't come up with a better one
Add Comment
Please, Sign In to add comment