Remapping key in one of two 'ahk_class qwidget' applications?

468 views Asked by At

I have two applications that have the same ahk_class (qwidget). How can I differentiate between them? Here is the info of window spy:

>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Writer - [Document 1 *]
ahk_class QWidget

&

VLC media player
ahk_class QWidget

I tried using the title of the window but that doesn't work either. E.g. #IfWinExist, Writer - [Document 1 *] (or #IfWinActive)

Any ideas? If I use

#IfWinActive, ahk_class QWidget
z::Send !{Left}
x::Send !{Right}

x & z is remapped in both.

Cheers

1

There are 1 answers

0
MCL On BEST ANSWER

Find out the underlying executable names via task manager, and identify your windows like #IfWinActive, ahk_exe vlc.exe ahk_class QWidget. Keep the window class, just to make sure there's no other (maybe even hidden) window involved; the narrower the selection, the more reliable it will be. Using the window title is usually okay, but it should be avoided where possible, since window titles can be dynamic. Especially editors and players almost always have dynamic titles.

Note that ahk_exe is AHK_L only.