1

I have problem with this Autohotkey Script, it work in maximized but didnt work in minimized Google Chrome browser

Loop
    {
    ControlSend, Chrome_RenderWidgetHostHWND1, {e}, Margonem MMORPG - Google Chrome
    Sleep, 1000
    }
cdonts
  • 9,304
  • 4
  • 46
  • 72
Matos
  • 11
  • 1

1 Answers1

1

Tested it out and you are correct! ControlSend doesn't work on a Chrome window that has been minimized. Why is the window minimized? Does it have to minimized? If this is the case than you are probably out of luck and will need to seek solutions in another language.

Otherwise the only solution I can think of would be to insure that Chrome is Maximized before using ControlSend. You can do this by checking it's state using WinGet with the option MinMax. Then using WinMaximize if it is Minimized. You can capture the window you previously viewing with WinGetActiveTile and after maximizing chrome, return your previous window to top most Active state using WinActivate.

It's also possible you need to Focus on your control before Sending your keys. You can do this with ControlFocus.

Example Code:

Loop {
WinGetActiveTitle, CurWindow
WinGet, OutputVar, MinMax, ahk_class Chrome_WidgetWin_1
If (OutputVar <= 0) {
   WinMaximize, ahk_class Chrome_WidgetWin_1
}
ControlFocus, Chrome_RenderWidgetHostHWND1, Margonem MMORPG - Google Chrome
ControlSend, Chrome_RenderWidgetHostHWND1, {e}, Margonem MMORPG - Google Chrome Chrome
WinActivate, %CurWindow%
Sleep 1000
}
errorseven
  • 2,672
  • 2
  • 14
  • 20