Jump to content

Trouble sending Ctrl+key via ControlSend to an inactive Chrome window


Go to solution Solved by genius257,

Recommended Posts

I'm trying to send Ctrl+PgUp to an inactive Chrome window (this key combination switches to a previous tab), but it works only if the window is active, it doesn't work with an inactive window:

ControlSend("New Tab - Google Chrome", "", "[CLASS:Chrome_RenderWidgetHostHWND]", "^{PGUP}")

 

Link to post
Share on other sites

Anyone able to send Ctrl+PgUp to an inactive Chrome window?

Some observations as I played around with Notepad to see if it's perhaps something Chrome-specific:

  • ControlSend ^{PGUP} works only on an active Chrome window
  • ControlSend ^v (the paste shortcut) works only on an active Notepad window
  • ControlSend {DEL} works on both active and inactive Notepad window
  • ControlSend "foobar" works on both active and inactive Notepad window

So it would seem like it's not Chrome-specific and that ControlSend can't send Ctrl sequences to inactive windows?

For the reference, I'm running up to date Windows 10 21H2 19044.1889 and using the latest AutoIt v3.3.16.0.

Link to post
Share on other sites
  • 2 weeks later...
  • Solution

Hi @BakedCakes.

A quick google search led me to AHK forum where another person had same troubles.

It seems it's a limitation with chrome, that it does not accept keys sent while inactive, explained here.

So you would need to use a WebDriver based solution or Temporarily activate the window while interacting with the window.

Link to post
Share on other sites

Thanks. I was hoping that I'm missing something obvious or making a mistake, instead of Chrome outright not accepting input when inactive, but the lack of replies in this thread and then your post do seem to hint on the latter being the case. Auto-focusing it is then.

Edited by BakedCakes
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...