Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- WinSize2Turbo.ahk, NEWER_NEWER_OLD_WinSize2Turbo.ahk, NEWER_OLD_WinSize2Turbo.ahk, OLD_WinSize2Turbo.ahk
- */
- ;started by Minimized Tabs Outliner.ahk when it's done executing
- ;>>>cut from MTO.ahk ;[NVM, WinSize2Turbo PROJECT FAILED]check if memory entry exists for WinSize2Turbo, if so then retrieve its value (the file path to WinSize2Turbo) and run WinSize2Turbo
- ;keeps running, does something when a window is created
- ;check if WinSize2Turbo memory entry exists, if not then make it (with path to this file as value so that Minimized Tabs Outliner.ahk can use it to run this file) and show a MsgBox about it
- #Requires AutoHotkey 2.0
- ;#NoTrayIcon
- Persistent()
- A_WinDelay := -1
- triggerWindows := RetrieveTriggerWindows()
- turboFinishInProgressHwnd := -1
- A_DetectHiddenWindows := true
- EVENT_SYSTEM_MINIMIZEEND := 0x0017
- EVENT_OBJECT_CREATE := 0x8000
- EVENT_OBJECT_DESTROY := 0x8001
- EVENT_OBJECT_LOCATIONCHANGE := 0x800B
- EVENT_OBJECT_NAMECHANGE := 0x800C
- HookEvent(EVENT_SYSTEM_MINIMIZEEND, HandleActiveWinEvent) ; "Tabs Outliner" & "Torrent"
- HookEvent(EVENT_OBJECT_CREATE, HandleActiveWinEvent) ; "Untitled - Notepad" (maybe also uTorrent)
- ;\ ̶i̶f̶ ̶y̶o̶u̶ ̶i̶n̶c̶l̶u̶d̶e̶ ̶t̶h̶i̶s̶,̶ ̶t̶h̶e̶n̶ ̶t̶h̶e̶ ̶c̶o̶d̶e̶ ̶b̶e̶l̶o̶w̶ ̶n̶e̶e̶d̶s̶ ̶t̶o̶ ̶c̶h̶e̶c̶k̶ ̶i̶f̶ ̶a̶ ̶s̶p̶e̶c̶i̶f̶i̶c̶ ̶w̶i̶n̶d̶o̶w̶ ̶h̶a̶d̶ ̶a̶l̶r̶e̶a̶d̶y̶ ̶c̶h̶a̶n̶g̶e̶d̶ ̶i̶n̶ ̶t̶h̶e̶ ̶l̶a̶s̶t̶ ̶1̶0̶s̶e̶c
- HookEvent(EVENT_OBJECT_DESTROY, HandleDestroyedWinEvent)
- HookEvent(EVENT_OBJECT_NAMECHANGE, HandleActiveWinEvent) ; "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" when TO is opened by the user instead of at startup (need to receive pause/unpause msg
- ; from MTO to prevent WinSize2Turbo from interfering with MTO when TO is opened minimized, the non-minimized MTO --option doesn't need it tho)
- ;keep bool status of the windows that were affected by WinSize2/WinSize2Turbo (or were fine already) until they are destroyed (HandleDestroyEvent), then no need for (last 10sec) timer shit
- ;ACTUALLY: I need to save the id when a window gets finished and then use that when it's destroyed to set its status to false ("Untitled - Notepad" for example can become something else..)
- HandleActiveWinEvent(hWinEventHook, event, hWnd, *)
- {
- try WinSetTransparent(0, hWnd)
- if (WinExist(hWnd))
- {
- ;try WinSetTransparent(0)
- for (iteratedWinTitle, iteratedWinInfo in triggerWindows)
- {
- if (iteratedWinInfo["finishStatus"])
- continue
- ;try winTitle := WinGetTitle() ;just for testing when there's an error......
- ;if (IsSet(winTitle) && winTitle = iteratedWinTitle) ;just for testing when there's an error......
- try
- if (WinGetTitle() ~= iteratedWinTitle)
- {
- WinGetPos(&triggerWindowX, &triggerWindowY, &triggerWindowWidth, &triggerWindowHeight)
- if
- (
- iteratedWinTitle != "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" &&
- triggerWindowX = triggerWindows[iteratedWinTitle]["xAxis"] &&
- triggerWindowY = triggerWindows[iteratedWinTitle]["yAxis"] &&
- triggerWindowWidth = triggerWindows[iteratedWinTitle]["width"] &&
- triggerWindowHeight = triggerWindows[iteratedWinTitle]["height"]
- )
- {
- iteratedWinInfo["finishStatus"] := true
- iteratedWinInfo["identifier"] := hWnd
- break
- }
- HookEvent(EVENT_OBJECT_LOCATIONCHANGE, HandleTurboFinishEvent)
- WinSetTransparent(0)
- global turboFinishInProgressHwnd := hWnd
- if (iteratedWinTitle = "Tabs Outliner" || iteratedWinTitle = "_crx_eggkanocgddhmamlbiijnphhppkpkmkl")
- {
- triggerWindows["Tabs Outliner"]["finishStatus"] := true
- triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"]["finishStatus"] := true
- triggerWindows["Tabs Outliner"]["identifier"] := hWnd
- triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"]["identifier"] := hWnd
- }
- else
- iteratedWinInfo["finishStatus"] := true, iteratedWinInfo["identifier"] := hWnd
- return
- }
- }
- ;try WinSetTransparent("Off")
- }
- try WinSetTransparent("Off")
- HandleTurboFinishEvent(hWinEventHook, event, hWnd, *)
- {
- if (hWnd = turboFinishInProgressHwnd)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- Sleep(5000)
- WinSetTransparent("Off", hWnd)
- global turboFinishInProgressHwnd := -1
- }
- }
- }
- HandleDestroyedWinEvent(hWinEventHook, event, hWnd, *)
- {
- for (iteratedWinTitle, iteratedWinInfo in triggerWindows)
- ; RemovedValue := ArrayObj.RemoveAt(Index) <~~ to remove window instances
- ;for (iteratedWinTitle, iteratedWinInstancesInfo in triggerWindows) ; if you open multiple "Untitled - Notepad" and the first one had to be fixed by WinSize2, then others will do too
- ;for (iteratedWinInstanceInfo in iteratedWinInstancesInfo) ; unless if you close it after it's fixed. so my script has to fix each instance of a window and skip fixed instances
- if (hWnd = iteratedWinInfo["identifier"])
- {
- MsgBox(iteratedWinTitle " is no longer turbo finished b/c it has been destroyed")
- if (iteratedWinTitle = "Tabs Outliner")
- {
- triggerWindows["Tabs Outliner"]["finishStatus"] := false
- triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"]["finishStatus"] := false
- triggerWindows["Tabs Outliner"]["identifier"] := -1
- triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"]["identifier"] := -1
- }
- else
- {
- iteratedWinInfo["finishStatus"] := false
- iteratedWinInfo["identifier"] := -1
- MsgBox(iteratedWinTitle " = " triggerWindows[iteratedWinTitle]["finishStatus"] " " iteratedWinInfo["finishStatus"])
- }
- return
- }
- }
- RetrieveTriggerWindows()
- {
- windows := Map()
- section := IniRead(A_AppData "\MagraSoft\WinSize2.INI", "WinSize")
- linesSplit := StrSplit(section, "`n")
- for (iteratedLine in linesSplit)
- {
- lineSplit := StrSplit(iteratedLine, ["=", ""])
- iteratedWinTitle := lineSplit[2]
- windows[iteratedWinTitle] := Map("identifier", -1, "finishStatus", false, "xAxis", lineSplit[3], "yAxis", lineSplit[4], "width", lineSplit[5], "height", lineSplit[6])
- }
- if (windows.Has("Tabs Outliner"))
- windows.Set("_crx_eggkanocgddhmamlbiijnphhppkpkmkl", Map("identifier", -1, "finishStatus", false))
- return windows
- }
- HookEvent(event, fnObj, pid := 0) => DllCall("SetWinEventHook", "UInt", event, "UInt", event, "Ptr", 0, "Ptr", CallbackCreate(fnObj), "UInt", pid, "UInt", 0, "UInt", 0)
- /*Don't let MTO use WinSize2Turbo to fix TO while it's still invisible, because it doesn't matter anymore if it's done when I unminimize TO. It will be instant then and this way MTO will be
- faster and shorter code
- I can also have WinSize2 paused by default and then unpause it temporarily right after both a window has been made invisible and the 2nd cb hook has been set, this might be the best way to
- do it
- Make another folder in the MTO repo called "Extra"? For WinSize2Turbo and the WinSize2.EXE
- the reason why WinSize2Turbo didn't work for tabs outliner when NewTab page isn't opened as well, is because:
- - WinSize2 didn't have an entry for: "_crx_eggkanocgddhmamlbiijnphhppkpkmkl"
- - WinSize2Turbo didn't use EVENT_OBJECT_SHOW for "_crx_eggkanocgddhmamlbiijnphhppkpkmkl"
- - maybe I should have a different cb for this, to make it invisible and wait for it to get renamed to "Tabs Outliner" so that WinSize2 will fix it (then no extra entry necessary)
- - WinSize2 probably can't even affect "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" before EVENT_OBJECT_SHOW
- - maybe not even after, b/c it gets renamed to "Tabs Outliner" soon after
- but I can try doing these things, maybe it works.. otherwise that stuff in WinSize2Turbo for "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" is useless
- like EVENT_OBJECT_NAMECHANGE, but I'm pretty sure "Untitled - Notepad" still needs it (not always but in one scenario it seemed to be necessary)
- I doubt that I can use EVENT_OBJECT_SHOW if MTO uses the renamed title "Tabs Outliner"
- BIGGER PROBLEM: can't hide windows fast enough that become unminimized, so this whole WinSize2Turbo script is useless <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< < < < < < <
- and yeah I tried both static and global, and uTorrent didn't even get an EVENT_SYSTEM_MINIMIZESTART nor EVENT_OBJECT_CREATE.. so it's super confusing and idk how to make it work then
- - MAYBE THE ANSWER IS: retrieve all existing windows and then make each minimized one invisible, doing this on a short interval like 5-10sec, maybe lower as long as the CPU usage stays 0%
- Some trash:
- HandleActiveWinEvent(hWinEventHook, event, hWnd, *)
- {
- static turboFinishInProgressHwnd := -1
- ;if (!WinExist(hWnd)) ;IT'S NECESSARY!!! THIS DID IN FACT EXECUTE<<<<< can remove this now
- ;MsgBox("THE IF STATEMENT BELOW IS NECESSARY IF THIS EVER EXECUTES, IF IT AIN'T NECESSARY THEN USE 'WinExist' W/O AN IF STATEMENT")
- try WinSetTransparent(0, hWnd)
- HandleTurboFinishEvent(hWinEventHook, event, hWnd, *)
- {
- ; The first one is WinSize2 resizing the target window and second one is WinSize2 repositioning the target window
- ;static matchCounter := 0
- if (hWnd = turboFinishInProgressHwnd)
- ;MsgBox("true")
- ;if (matchCounter > 1)
- ;MsgBox("wtf")
- ;MsgBox(turboFinishInProgressHwnd)
- ;DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- ;if (hWnd = turboFinishInProgressHwnd && ++matchCounter = 2)
- ;if (++matchCounter = 2)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- Sleep(5000)
- ;MsgBox("title: " WinGetTitle(hWnd) " class: " WinGetClass(hWnd))
- WinSetTransparent("Off", hWnd)
- turboFinishInProgressHwnd := -1
- }
- }*/
- ;********** NEWER_NEWER_OLD_WinSize2Turbo.ahk **********
- ;started by Minimized Tabs Outliner.ahk when it's done executing
- ;keeps running, does something when a window is created
- ;check if WinSize2Turbo memory entry exists, if not then make it (with path to this file as value so that Minimized Tabs Outliner.ahk can use it to run this file) and show a MsgBox about it
- #Requires AutoHotkey 2.0
- ;#NoTrayIcon
- Persistent()
- A_WinDelay := -1
- triggerWindows := RetrieveTriggerWindows()
- A_DetectHiddenWindows := true
- EVENT_SYSTEM_MINIMIZEEND := 0x0017
- EVENT_OBJECT_CREATE := 0x8000
- EVENT_OBJECT_DESTROY := 0x8001
- EVENT_OBJECT_LOCATIONCHANGE := 0x800B
- EVENT_OBJECT_NAMECHANGE := 0x800C
- HookEvent(EVENT_SYSTEM_MINIMIZEEND, HandleActiveWinEvent) ; "Tabs Outliner" & "Torrent"
- HookEvent(EVENT_OBJECT_CREATE, HandleActiveWinEvent) ; "Untitled - Notepad" (maybe also uTorrent)
- ;\ ̶i̶f̶ ̶y̶o̶u̶ ̶i̶n̶c̶l̶u̶d̶e̶ ̶t̶h̶i̶s̶,̶ ̶t̶h̶e̶n̶ ̶t̶h̶e̶ ̶c̶o̶d̶e̶ ̶b̶e̶l̶o̶w̶ ̶n̶e̶e̶d̶s̶ ̶t̶o̶ ̶c̶h̶e̶c̶k̶ ̶i̶f̶ ̶a̶ ̶s̶p̶e̶c̶i̶f̶i̶c̶ ̶w̶i̶n̶d̶o̶w̶ ̶h̶a̶d̶ ̶a̶l̶r̶e̶a̶d̶y̶ ̶c̶h̶a̶n̶g̶e̶d̶ ̶i̶n̶ ̶t̶h̶e̶ ̶l̶a̶s̶t̶ ̶1̶0̶s̶e̶c
- HookEvent(EVENT_OBJECT_DESTROY, HandleDestroyedWinEvent)
- HookEvent(EVENT_OBJECT_NAMECHANGE, HandleActiveWinEvent) ; "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" when TO is opened by the user instead of at startup (need to receive pause/unpause msg
- ; from MTO to prevent WinSize2Turbo from interfering with MTO when TO is opened minimized, the non-minimized MTO --option doesn't need it tho)
- ;keep bool status of the windows that were affected by WinSize2/WinSize2Turbo (or were fine already) until they are destroyed (HandleDestroyEvent), then no need for (last 10sec) timer shit
- ;ACTUALLY: I need to save the id when a window gets finished and then use that when it's destroyed to set its status to false ("Untitled - Notepad" for example can become something else..)
- HandleActiveWinEvent(hWinEventHook, event, hWnd, *)
- {
- ;if (!WinExist(hWnd)) ;IT'S NECESSARY!!! THIS DID IN FACT EXECUTE<<<<< can remove this now
- ;MsgBox("THE IF STATEMENT BELOW IS NECESSARY IF THIS EVER EXECUTES, IF IT AIN'T NECESSARY THEN USE 'WinExist' W/O AN IF STATEMENT")
- if (WinExist(hWnd))
- for (iteratedWinTitle, iteratedWinInfo in triggerWindows)
- {
- ; Checking if iterated window has been finished already
- if (iteratedWinInfo[1])
- continue
- ;try winTitle := WinGetTitle() ;just for testing when there's an error......
- ;if (IsSet(winTitle) && winTitle = iteratedWinTitle) ;just for testing when there's an error......
- try
- if (WinGetTitle() = iteratedWinTitle)
- {
- WinGetPos(&triggerWindowX, &triggerWindowY, &triggerWindowWidth, &triggerWindowHeight)
- if
- (
- iteratedWinTitle != "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" &&
- triggerWindowX = triggerWindows[iteratedWinTitle][2] &&
- triggerWindowY = triggerWindows[iteratedWinTitle][3] &&
- triggerWindowWidth = triggerWindows[iteratedWinTitle][4] &&
- triggerWindowHeight = triggerWindows[iteratedWinTitle][5]
- )
- {
- triggerWindows[iteratedWinTitle][1] := true
- continue
- }
- HookEvent(EVENT_OBJECT_LOCATIONCHANGE, HandleTurboFinishEvent, WinGetPID())
- WinSetTransparent(0)
- if (iteratedWinTitle = "Tabs Outliner" || iteratedWinTitle = "_crx_eggkanocgddhmamlbiijnphhppkpkmkl")
- triggerWindows["Tabs Outliner"][1] := true, triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"][1] := true
- else
- iteratedWinInfo[1] := true
- return
- }
- }
- HandleTurboFinishEvent(hWinEventHook, event, hWnd, *)
- {
- ; The first one is WinSize2 resizing the target window and second one is WinSize2 repositioning the target window
- static matchCounter := 0
- if (++matchCounter = 2)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- WinSetTransparent("Off", hWnd)
- }
- }
- }
- HandleDestroyedWinEvent(hWinEventHook, event, hWnd, *)
- {
- for (iteratedWinTitle, iteratedWinInfo in triggerWindows)
- {
- try winTitle := WinGetTitle(hWnd) ;just for testing when there's an error......
- if (IsSet(winTitle) && winTitle = iteratedWinTitle) ;just for testing when there's an error......
- ;try
- ;if (WinGetTitle() = iteratedWinTitle)
- {
- MsgBox(iteratedWinTitle " is no longer turbo finished b/c it has been destroyed")
- if (iteratedWinTitle = "Tabs Outliner")
- triggerWindows["Tabs Outliner"][1] := true, triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"][1] := true
- else
- {
- iteratedWinInfo[1] := false
- MsgBox(iteratedWinTitle " = " triggerWindows[iteratedWinTitle][1] " " iteratedWinInfo[1])
- }
- return
- }
- }
- }
- RetrieveTriggerWindows()
- {
- windows := Map()
- section := IniRead(A_AppData "\MagraSoft\WinSize2.INI", "WinSize")
- linesSplit := StrSplit(section, "`n")
- for (iteratedLine in linesSplit)
- lineSplit := StrSplit(iteratedLine, ["=", ""]), iteratedWinTitle := lineSplit[2], windows[iteratedWinTitle] := [false, lineSplit[3], lineSplit[4], lineSplit[5], lineSplit[6]]
- if (windows.Has("Tabs Outliner"))
- windows.Set("_crx_eggkanocgddhmamlbiijnphhppkpkmkl", [false])
- return windows
- }
- HookEvent(event, fnObj, pid := 0) => DllCall("SetWinEventHook", "UInt", event, "UInt", event, "Ptr", 0, "Ptr", CallbackCreate(fnObj), "UInt", pid, "UInt", 0, "UInt", 0)
- ;********** NEWER_OLD_WinSize2Turbo.ahk **********
- ;started by Minimized Tabs Outliner.ahk when it's done executing
- ;keeps running, does something when a window is created
- ;check if WinSize2Turbo memory entry exists, if not then make it (with path to this file as value so that Minimized Tabs Outliner.ahk can use it to run this file) and show a MsgBox about it
- #Requires AutoHotkey 2.0
- ;#NoTrayIcon
- Persistent()
- A_WinDelay := -1
- EVENT_SYSTEM_MINIMIZEEND := 0x0017
- EVENT_OBJECT_CREATE := 0x8000
- EVENT_OBJECT_LOCATIONCHANGE := 0x800B
- EVENT_OBJECT_NAMECHANGE := 0x800C
- HookEvent(EVENT_SYSTEM_MINIMIZEEND, HandleWinEvent) ; "Tabs Outliner" & "Torrent"
- HookEvent(EVENT_OBJECT_CREATE, HandleWinEvent) ; "Untitled - Notepad" (maybe also uTorrent)
- ;\ ̶i̶f̶ ̶y̶o̶u̶ ̶i̶n̶c̶l̶u̶d̶e̶ ̶t̶h̶i̶s̶,̶ ̶t̶h̶e̶n̶ ̶t̶h̶e̶ ̶c̶o̶d̶e̶ ̶b̶e̶l̶o̶w̶ ̶n̶e̶e̶d̶s̶ ̶t̶o̶ ̶c̶h̶e̶c̶k̶ ̶i̶f̶ ̶a̶ ̶s̶p̶e̶c̶i̶f̶i̶c̶ ̶w̶i̶n̶d̶o̶w̶ ̶h̶a̶d̶ ̶a̶l̶r̶e̶a̶d̶y̶ ̶c̶h̶a̶n̶g̶e̶d̶ ̶i̶n̶ ̶t̶h̶e̶ ̶l̶a̶s̶t̶ ̶1̶0̶s̶e̶c
- HookEvent(EVENT_OBJECT_NAMECHANGE, HandleWinEvent) ; "_crx_eggkanocgddhmamlbiijnphhppkpkmkl" when TO is opened by the user instead of at startup (need to receive pause/unpause msg from MTO
- ; to prevent WinSize2Turbo from interfering with MTO when TO is opened minimized, the non-minimized MTO --option doesn't need it tho)
- ;keep ahk_ids of the windows that were affected by WinSize2/WinSize2Turbo until they are destroyed (HandleDestroyEvent), then no need for (last 10sec) timer shit
- ;and this will then work no matter what the window title was at the time WinSize2Turbo did something to it (TO has two possible titles so yeah)
- triggerWindows := RetrieveTriggerWindows()
- RetrieveTriggerWindows()
- {
- windows := Map()
- section := IniRead(A_AppData "\MagraSoft\WinSize2.INI", "WinSize")
- linesSplit := StrSplit(section, "`n")
- for (iteratedLine in linesSplit)
- iteratedWinTitle := StrSplit(iteratedLine, ["=", ""])[2], windows[iteratedWinTitle] := false
- if (windows.Has("Tabs Outliner"))
- windows.Set("_crx_eggkanocgddhmamlbiijnphhppkpkmkl", false)
- return windows
- }
- A_DetectHiddenWindows := "On" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- HandleWinEvent(hWinEventHook, event, hWnd, *)
- {
- ; THESE CAN BE MADE GLOBAL I THINK O.O b/c the event constants are as well... consider doing this if the turbo finish isn't quick enough
- ;static triggerWindows := RetrieveTriggerWindows()
- /*static count := 0
- if (++count = 1)
- for (iteratedWindow in triggerWindows)
- MsgBox("test: " iteratedWindow)*/
- try
- {
- ;MsgBox(WinExist(hWnd) " " WinExist() " " WinGetTitle())
- WinExist(hWnd), testTitle := WinGetTitle()
- if (testTitle = "Untitled - Notepad")
- MsgBox("yes")
- }
- ; CHECK IF THE TWO 'try's ARE RLY NECESSARY
- if (WinExist(hWnd)) ; try?
- for (iteratedWinTitle, isIteratedWinFinished in triggerWindows)
- {
- if (isIteratedWinFinished)
- continue
- ;try MsgBox(WinGetTitle(hWnd))
- try if (WinGetTitle() = iteratedWinTitle)
- {
- MsgBox("in progress")
- HookEvent(EVENT_OBJECT_LOCATIONCHANGE, HandleFinishEvent, WinGetPID())
- WinSetTransparent(0)
- if (iteratedWinTitle = "Tabs Outliner" || iteratedWinTitle = "_crx_eggkanocgddhmamlbiijnphhppkpkmkl")
- triggerWindows["Tabs Outliner"] := true, triggerWindows["_crx_eggkanocgddhmamlbiijnphhppkpkmkl"] := true
- else
- triggerWindows[iteratedWinTitle] := true
- }
- }
- HandleFinishEvent(hWinEventHook, *)
- {
- ; The first one is WinSize2 resizing the target window and second one is WinSize2 repositioning the target window
- static matchCounter := 0
- if (++matchCounter = 2)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- WinSetTransparent("Off")
- }
- }
- RetrieveTriggerWindows()
- {
- windows := Map()
- section := IniRead(A_AppData "\MagraSoft\WinSize2.INI", "WinSize")
- linesSplit := StrSplit(section, "`n")
- for (iteratedLine in linesSplit)
- iteratedWinTitle := StrSplit(iteratedLine, ["=", ""])[2], windows[iteratedWinTitle] := false
- if (windows.Has("Tabs Outliner"))
- windows.Set("_crx_eggkanocgddhmamlbiijnphhppkpkmkl", false)
- return windows
- }
- }
- HookEvent(event, fnObj, pid := 0) => DllCall("SetWinEventHook", "UInt", event, "UInt", event, "Ptr", 0, "Ptr", CallbackCreate(fnObj), "UInt", pid, "UInt", 0, "UInt", 0)
- ;********** OLD_WinSize2Turbo.ahk **********
- ;REMEMBER: TitleTimer=200 is probably what makes WinSize2 so slow, maybe I should temporarily change that to 10
- ;started by Minimized Tabs Outliner.ahk when it's done executing
- ;keeps running, does something late at startup and when a window is created
- ;check if WinSize2Turbo memory entry exists, if not then make it (with path to this file as value so that Minimized Tabs Outliner.ahk can use it to run this file) and show a MsgBox about it
- A_WinDelay := 0
- ;check if "ahk_id " is needed, or if it can just be this_id, pretty sure it isn't necessary b/c the callbacks didn't use it (it's also in Minimized Tabs Outliner.ahk)
- /*static titles := Array(), isIterationInProgress
- section := IniRead(A_AppData "\MagraSoft\WinSize2.INI", "WinSize")
- linesSplit := StrSplit(section, "`n")
- for (line in linesSplit)
- if (!InStr(line, "Tabs Outliner"))
- titles.Push(StrSplit(line, "=")[2])
- ids := WinGetList()
- for (this_title in titles)
- for (this_id in ids)
- if (WinGetTitle("ahk_id " this_id) = this_title && !WinActive(this_id))
- {
- isIterationInProgress := true
- DllCall("SetWinEventHook",
- "UInt", 0x800B, ; EVENT_OBJECT_LOCATIONCHANGE
- "UInt", 0x800B, ; EVENT_OBJECT_LOCATIONCHANGE
- "Ptr", 0,
- "Ptr", CallbackCreate(HandleStartupEvent),
- "UInt", WinGetPID(),
- "UInt", 0,
- "UInt", 0)
- WinSetTransparent(0)
- WinActivate()
- while (isIterationInProgress)
- Sleep(50)
- }
- HandleStartupEvent(hWinEventHook, event, hWnd, *)
- {
- ; The first one is WinSize2 resizing the target window and second one is WinSize2 repositioning the target window
- static matchCounter := 0
- if (++matchCounter = 2)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- WinMinimize()
- WinSetTransparent("Off")
- isIterationInProgress := false
- }
- }*/
- ;set hook for EVENT_OBJECT_CREATE and for EVENT_OBJECT_NAMECHANGE, then if the first one didn't see it then the second one will
- ;basic stuff inside the cb (add the extra stuff yourself for having two callbacks):
- /*titleToCompare := WinGetTitle(hWnd)
- for (this_title in titles)
- if (titleToCompare = this_title)
- {
- isIterationInProgress := true
- WinSetTransparent(0)
- DllCall("SetWinEventHook",
- "UInt", 0x800B, ; EVENT_OBJECT_LOCATIONCHANGE
- "UInt", 0x800B, ; EVENT_OBJECT_LOCATIONCHANGE
- "Ptr", 0,
- "Ptr", CallbackCreate(HandleFinishEvent),
- "UInt", WinGetPID(),
- "UInt", 0,
- "UInt", 0)
- while (isIterationInProgress)
- Sleep(50)
- }
- HandleFinishEvent(hWinEventHook, event, hWnd, *)
- {
- ; The first one is WinSize2 resizing the target window and second one is WinSize2 repositioning the target window
- static matchCounter := 0
- if (++matchCounter = 2)
- {
- DllCall("UnhookWinEvent", "Ptr", hWinEventHook)
- WinSetTransparent("Off")
- isIterationInProgress := false
- }
- }*/
Add Comment
Please, Sign In to add comment