AHK _Class problem
The class Chrome_WidgetWin1 is used by a variety of software. You may hit this roadblock in the future again, so it's a good exercice to learn other methods.
The AutoHotKey installation folder (should be: C:\Program Files\AutoHotkey) contains a veyr useful ahk script called "window spy".
You can use it to easily find the ahk_class of a window, but also:
its title (usually the same as the one in the top bar of the window)
its exe (the .exe that spawned it)
And much more.
For the simple scenario that you are describing and since we're talking about two different programs, you could replace instances of ahk_class Chrome_WidgetWin_1 to ahk_exe your_program.exe.
Note that if the programs in question have multiple windows open at the same time, AutoHotKey will, depending on the script's settings, either apply the instructions to the first window it finds that belongs to the indicated .exe (usually searching from the foremost windows and going down the pile), or to all of them.
If the programs you use have multiple windows open at one time then, using their title would be better. For that, just type the title literally, without enclosing quotes.
Examples:
currently:
intended for one program
WinActivate, ahk_class Chrome_WidgetWin_1
WinWaitActive, ahk_class Chrome_WidgetWin_1
Send, Hello{Enter}
intended for another one
WinActivate, ahk_class Chrome_WidgetWin_1
WinWaitActive, ahk_class Chrome_WidgetWin_1
Send, +{Tab}{Space}
This solution may be problematic, whereas this one
new script:
intended for one program
WinActivate, ahk_exe program_1.exe
WinWaitActive, ahk_exe program_1.exe
Send, Hello{Enter}
intended for another one
WinActivate, program_2.exe
WinWaitActive, program_2.exe
Send, +{Tab}{Space}
should work better, as long as these programs don't have multiple windows, in which case it may or may not work depending on several factors.
Try that method, and come back to let us know how it went. There are many more solutions if your use case require
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 accountSign in
Already have an account? Sign in here.
Sign In Now