0

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

JonesR
  • 9
  • 1
  • 3
  • Find out the underlying executable names via task manager (if you don't know them already), 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 window involved; the narrower the selection, the more reliable it will be. – MCL Dec 06 '13 at 11:07
  • Thanks, this is exactly what I needed. Any way I can mark your comment as the answer to the question? – JonesR Dec 06 '13 at 12:58
  • There you go, it's an answer now ;) – MCL Dec 06 '13 at 13:20

1 Answers1

0

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.

MCL
  • 3,985
  • 3
  • 27
  • 39