2017-08-03 39 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 
…