Author Topic: I want to emulate an ALT-TAB hotkey function for specific target program.  (Read 850 times)

Olias

  • Newbie
  • *
  • Posts: 8
If this has already been answered, I couldn't find it so please point me to the right post. Ideally I'd like to use a VA command and avoid inline code if possible.

Objective: I want to emulate an ALT-TAB hotkey function to a specific open program without the need to tab through all the open programs. The VA "Display Window" function only allows for switching to an already  open "Windows Title" with a specific name. If that title is not already open or if one activates another tab in the program such as Chrome(in my case) or the windows title changes, VA can't find the program and issues the error message:

Quote
"Unable to acquire window or process for window function".

USE-CASE
I want to bring the last active Chrome window to the front. As an example, if one double clicks on a URL shortcut on the Windows desktop, Windows will focus the last active browser window and bring it to the front with the URL named in the shortcut. I'd prefer just to bring up the most recent window though. If no browser is open, Windows just starts the default browser. In my case I just want to bring focus to any open browser, Ideally a with new tab but a simple CTRL-T via VA is the better workaround for that in my view.

Example Behavior: The One example of emulating the behavior I am looking for would be to do the following steps.
  • Create a shortcut to any URL on the desktop.
  • In a separate action, open up two or more browser windows and navigate to any random websites in each browser window so that the titles are different.
  • Open any random app such as notepad and make sure that this app is the focused window so that it occludes the browser behind it.
  • Now double click on the desktop shortcut to see Windows simply open up a tab in whatever was the last active browser and bring that browser to the front and change it to the active window focus.

I have some ideas of how to do this with inline code but I was hoping that there was a simpler way to do it with a VA command I somehow overlooked.

Note: The experiment I tested with has Windows configured as Chrome set to default browser.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: I want to emulate an ALT-TAB hotkey function for specific target program.
« Reply #1 on: November 09, 2020, 08:58:21 PM »
Have you tried using the " - Google Chrome" suffix with a wildcard as the target window title?

Olias

  • Newbie
  • *
  • Posts: 8
Re: I want to emulate an ALT-TAB hotkey function for specific target program.
« Reply #2 on: November 09, 2020, 10:10:22 PM »
Brilliant!!! That worked perfectly. The actual string I had to use was *Google Chrome* but it performs exactly as I had hoped. Thank you.