Skip to content

Commit

Permalink
Wait for windows because SetWinDelay -1
Browse files Browse the repository at this point in the history
  • Loading branch information
t5mat committed Aug 22, 2022
1 parent 04b835c commit 6a867b6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions night.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ WaitWindowExist(WinTitle, SleepAmount, Timeout) {
}
}

WaitWindowActive(WinTitle, SleepAmount, Timeout) {
Start := A_TickCount
while (!WinActive(WinTitle)) {
Sleep % SleepAmount
if (A_TickCount - Start > Timeout) {
return false
}
}
return true
}

WaitWindowNotActive(WinTitle, SleepAmount, Timeout) {
Start := A_TickCount
while (WinActive(WinTitle)) {
Expand Down Expand Up @@ -596,6 +607,9 @@ WaitFocusColorizeWindow() {
}

WinActivate % "ahk_id " Hwnd
if (!WaitWindowActive("ahk_id " Hwnd, 5, 1000)) {
return
}

WinGetPos, , , Width, Height, % "ahk_id " Hwnd
if (!Width) {
Expand Down Expand Up @@ -915,15 +929,25 @@ $XButton1::
if (!(Hwnd := WinExist(AppProjectWindowTitle))) {
return
}

WinActivate % "ahk_id " Hwnd
if (!WaitWindowActive("ahk_id " Hwnd, 5, 1000)) {
return
}

SendEvent % MacroKeys["Show Lower Zone MixConsole Page " MixConsolePage] MacroKeys["Edit - Open/Close Editor"]
return

$XButton2::
if (!(Hwnd := WinExist(AppProjectWindowTitle))) {
return
}

WinActivate % "ahk_id " Hwnd
if (!WaitWindowActive("ahk_id " Hwnd, 5, 1000)) {
return
}

SendEvent % MacroKeys["Show Lower Zone MixConsole Page " MixConsolePage]
return

Expand Down

0 comments on commit 6a867b6

Please sign in to comment.