[uwsc]文字列でウィンドウ(ウィンドウタイトル)を探す

開いているウインドウの中から、文字列に合うウィンドウ(ウィンドウタイトル)を探します。

reg = "chrome"
w = GETALLWIN()
For i = 0 to w-1
	title = STATUS(ALL_WIN_ID[i], ST_TITLE)
	ifb regTest(reg,title) then
		print title
	endif
Next

function regTest(reg,str)
	re = CreateOleObj("VBScript.RegExp")
	re.pattern = reg
	re.Global = True
	re.IgnoreCase = True
	ifb true = re.test(str) then
		result = true
	else
		result = false
	endif
fend

参考:UWSCで正規表現を使う

コメントを残す

メールアドレスが公開されることはありません。