Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Time Saver.ahk:
- ********** AUTOMATION FEATURES **********
- Open a network stream in VLC once you click "Copy Stream URL" in uTorrent.
- Assist the Chrome extension "Tabs Outliner" by making sure it has finished saving before getting closed.
- 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).
- IMPORTANT: in Thunderbird enable "When Thunderbird is minimized, move it to the tray" and install extension "KeepRunning". And move script to: %UserProfile%\Downloads\AutoHotkey
- 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).
- 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.
- Showing a close btn in fullscreen when your cursor reaches the top-right corner and making the fullscreen controller immovable, centered at the bottom.
- 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).
- Auto-close the annoying WinRAR and Software Ideas Modeler notifications.
- Unfocus the minimized uTorrent window at startup to prevent key presses from affecting it by accident.
- 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).
- Scroll namespace to top when nearby on VS edit control show event.
- tbl := CreateTaskbarList()
- thunderbirdWinEventHook := HookEvent(EVENT_OBJECT_CREATE, HandleCreatedThunderbirdEvent)
- try Run("thunderbird.exe",, "Max")
- catch
- DllCall("UnhookWinEvent", "Ptr", thunderbirdWinEventHook)
- HookEvent(EVENT_OBJECT_CREATE, HandleCreatedVlcEvent)
- HookEvent(EVENT_OBJECT_REORDER, HandleReorderedVlcEvent)
- HookEvent(EVENT_SYSTEM_FOREGROUND, HandleActivatedWindowVlcEvent)
- HookEvent(EVENT_SYSTEM_FOREGROUND, HandleChangedFullscreenWinEvent)
- HookEvent(EVENT_OBJECT_SHOW, HandleChangedFullscreenWinEvent)
- HookEvent(EVENT_OBJECT_SHOW, HandleShowedNotificationEvent)
- fullscreenVlcCloseButtonMouseEventHook := PointerDeviceHook("Move|LButton Down", HandleFullscreenVlcCloseButtonMouseEvent, true)
- ManageVisualStudioEventHandlers() ; Has a loop, so keep this at the bottom
- CreateTaskbarList()
- {
- iid_ITaskbarList := "{56FDF342-FD6D-11d0-958A-006097C9A090}" ; Interface id (iid)
- clsid_TaskbarList := "{56FDF344-FD6D-11d0-958A-006097C9A090}" ; Class id (clsid)
- tbl := ComObject(clsid_TaskbarList, iid_ITaskbarList) ; Creates the TaskbarList object
- loop (10)
- {
- try ComCall(3, tbl) ; Calls tbl.HrInit(), which initializes the TaskbarList object
- catch
- Sleep(50)
- else
- break
- }
- return tbl
- }
- ; Allows Thunderbird to properly load b/c otherwise you'd have to click the taskbar icon twice to open it
- HandleCreatedThunderbirdEvent(hWinEventHook, event, hWnd, *)
- {
- static thunderbirdIsBeingLoaded := false
- ; Most windowing functions that are given a pure HWND will also work while it's hidden
- try shouldExecute := WinGetClass(hWnd) = "MozillaWindowClass" && WinGetProcessName(hWnd) = "thunderbird.exe" && !thunderbirdIsBeingLoaded
- if (shouldExecute ?? false)
- {
- thunderbirdIsBeingLoaded := true
- WinSetTransparent(0, hWnd)
- ComCall(5, tbl, "Ptr", hWnd) ; Calls tbl.DeleteTab(winId), which deletes a tab from the TaskbarList
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- loop (3)
- {
- ; Aborts if thunderbird does not have the configuration to be closed automatically (follow the instructions at the top of the script)
- if (!WinWaitClose(hWnd,, 10))
- {
- ProcessClose("thunderbird.exe")
- return
- }
- WinActivate(hWnd)
- WinMinimize(hWnd)
- }
- Sleep(100)
- WinSetTransparent("Off", hWnd)
- ComCall(4, tbl, "Ptr", hWnd) ; Calls tbl.AddTab(winId), which adds a tab to the TaskbarList
- }
- }
- Time Saver.xml:
- <?xml version="1.0" encoding="UTF-16"?>
- <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
- <Triggers>
- <LogonTrigger>
- <Enabled>true</Enabled>
- </LogonTrigger>
- </Triggers>
- <Settings>
- <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
- <IdleSettings>
- <StopOnIdleEnd>false</StopOnIdleEnd>
- </IdleSettings>
- <AllowStartOnDemand>true</AllowStartOnDemand>
- <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
- <Priority>5</Priority>
- </Settings>
- <Actions Context="Author">
- <Exec>
- <Command>"%ProgramFiles%\AutoHotkey\v2\AutoHotkey.exe"</Command>
- <Arguments>"%UserProfile%\Downloads\AutoHotkey\Time Saver.ahk"</Arguments>
- <WorkingDirectory>%UserProfile%\Downloads\AutoHotkey</WorkingDirectory>
- </Exec>
- </Actions>
- </Task>
Comments
-
- 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:
- HandleCreatedOutlookEvent(hWinEventHook, event, hWnd, *)
- {
- static outlookIsBeingLoaded := false
- ; Most windowing functions that are given a pure HWND will also work while it's hidden (dunno if it matters here but still)
- try shouldExecute := WinGetClass(hWnd) = "Olk Host" && !outlookIsBeingLoaded
- if (shouldExecute ?? false)
- {
- outlookIsBeingLoaded := true
- WinSetTransparent(0, hWnd)
- ComCall(5, tbl, "Ptr", hWnd) ; Calls tbl.DeleteTab(winId), which deletes a tab from the TaskbarList
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- ; while (!WinExist("- Outlook ahk_exe olk.exe")) ; Minimum delay for the minimize to work
- ; WinSetTransparent(0, hWnd) ; Making Outlook temporarily transparent (multiple times because it doesn't always work)
- ; WinSetTransparent(0, hWnd) ; Making Outlook temporarily transparent (again in case the loop above didn't already succeed)
- WinWait("- Outlook ahk_exe olk.exe") ; Minimum delay for the minimize to work
- 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
- WinMinimize(hWnd)
- WinSetTransparent("Off", hWnd)
- ComCall(4, tbl, "Ptr", hWnd) ; Calls tbl.AddTab(winId), which adds a tab to the TaskbarList
- }
- }
-
- 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