Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

autohotkey partial window title match (without ahk class)

Tags:

autohotkey

I would like to add partial window title matching to #IfWinActive. For example to match any notepad window, regardless wether the title is "Untitled - Notepad" or "MyFile - Notepad"

This should be very simple. My attemtps:

SetTitleMatchMode, Regex
SetTitleMatchMode, Slow

#IfWinActive *.Notepad
+n::b
#IfWinActive

second attempt matchmode 2 should match anywhere

SetTitleMatchMode, 2
#IfWinActive Notepad
+n::b
#IfWinActive

A test with using the full title Untitled - Notepad confirms that the code +n::b does substute Shift-n for Shift-b

NOTE: ahk_class is not an option as the class is different on every machine for the target programme TeXnicCenter

like image 801
Nino van Hooff Avatar asked Jun 01 '13 12:06

Nino van Hooff


1 Answers

As Robert Ilbrink said, my second example actually works, and the problem was that I did not place SetTitleMatchMode at the very top of my script.

The default example script for ^!n was in effect and interfered. Not exactly sure why it does that, but placing SetTitleMatchMode at the top solved my problem.

like image 146
Nino van Hooff Avatar answered Nov 12 '22 17:11

Nino van Hooff