Skip to content

Instantly share code, notes, and snippets.

@The1nk
Last active December 1, 2022 20:38
Show Gist options
  • Select an option

  • Save The1nk/4ff0781d925a08ff9accdbd5251873cc to your computer and use it in GitHub Desktop.

Select an option

Save The1nk/4ff0781d925a08ff9accdbd5251873cc to your computer and use it in GitHub Desktop.
Helper to dismiss annoying popups on CoD MW2, and help set focus to the game if opened via Big Picture Mode... Crafted with <3 for the Steam Deck
CodCheck := True
Loop {
Sleep(2500)
WinTitle := "Set Optimal Settings?"
if WinExist(WinTitle) {
WinActivate
SendInput "N"
Sleep(500)
}
WinTitle := "Run In Safe Mode?"
if WinExist(WinTitle) {
WinActivate
SendInput "N"
Sleep(500)
}
if (!CodCheck)
Continue
ActiveHwnd := WinExist("A")
BpmHwnd := 0
CodHwnd := 0
; big picture mode with gamepadui
WinTitle := "SP"
WinClass := "SDL_app"
WinExe := "steamwebhelper.exe"
if WinExist(WinTitle) or WinExist("ahk_class" WinClass) or WinExist("ahk_exe" WinExe) {
BpmHwnd := WinGetId()
}
; big picture mode without -gamepadui
WinTitle := "Steam"
WinClass := "CUIEngineWin32"
WinExe := "steam.exe"
if WinExist(WinTitle) or WinExist("ahk_class" WinClass) or WinExist("ahk_exe" WinExe) {
BpmHwnd := WinGetId()
}
if (BpmHwnd == 0)
Continue
WinTitle := "Call of Duty® HQ"
WinClass := "IW9"
WinExe := "cod.exe"
if WinExist(WinTitle) or WinExist("ahk_class" WinClass) or WinExist("ahk_exe" WinExe) {
if (!WinExist("ahk_class CoD Splash Screen"))
CodHwnd := WinGetId()
}
if (CodHwnd == 0)
Continue
if (ActiveHwnd == BpmHwnd) {
; Prompt!
Choice := MsgBox("Big Picture Mode and COD both open, and Big Picture Mode has focus. Switch to COD? If no, won't check again.", "Focus COD?", 4 + 4096)
if (Choice == "Yes") {
WinActivate("ahk_id" CodHwnd)
} else {
MsgBox("Disabled")
CodCheck := false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment