2017-08-03 69 views
0

我有一个AutoHotkey的脚本,其检查与If WinActive("WFC-16 - Windows Internet Explorer")匹配任何0-9数字与WinActive()

我需要改变这对匹配任何2位数字活动窗口标题。 I.E. If WinActive("WFC-## - Windows Internet Explorer")

我可以使用RegEx-like修饰符来匹配任何使用WinActive()0-9号码吗?

回答

1

是的,你可以,我没有看到任何问题。

SetTitleMatchMode RegEx 
If WinActive("^WFC-\d\d - Windows Internet Explorer") 
… 

我建议你放弃« - 的Windows Internet Explorer»后缀,并添加ahk_exe IEXPLORE.EXE代替,因为不同的IE版本在标题不同的名称。

SetTitleMatchMode RegEx 
If WinActive("^WFC-\d\d ahk_exe iexplore.exe") 
… 

的另一种方法,如果它是很难写的标题匹配特定规则(或者,如果规则过于复杂),是让当前窗口的标题和做任何测试:

WinGetTitle wintitle, A 
If (wintitle~="^WFC-\d\d") ; ~= is a shortcut for RegexMatch 
…