「ソースの表示」ウィンドウがIEの後ろに隠れる。(その2)
スクリプトで新規の「ソースの表示」ウィンドウを監視して、3秒以内に隠れたら前に出します。
Win32APIを呼ぶために、Excelを使用します。
view-source-focus.vbs
Set ie=CreateObject("InternetExplorer.Application")
ie.ToolBar=False
ie.Visible=True
ie.Navigate "about:blank"
Set dic=CreateObject("Scripting.Dictionary")
Set wShell=CreateObject("WScript.Shell")
Set ExcelApplication=CreateObject("Excel.Application")
Do
hwnd=ExcelApplication.ExecuteExcel4Macro("CALL(""user32"",""FindWindowA"",""JCJ"",""HTMLSOURCEVIEW"",0)")
ie.Document.body.insertAdjacentText "beforeEnd",hwnd & vbCrLf
If hwnd=0 Then
dic.RemoveAll
ElseIf Not dic.Exists(hwnd) Then
dic.Add hwnd,Empty
For k=1 To 3
r=ExcelApplication.ExecuteExcel4Macro("CALL(""user32"",""SetForegroundWindow"",""JJ""," & hwnd & ")")
ie.Document.body.insertAdjacentText "beforeEnd",r & vbCrLf
If r=0 Then
wShell.SendKeys "%{tab}"
wShell.AppActivate " - 元のソース"
End If
WScript.Sleep 1000
Next
End If
WScript.Sleep 1000
Loop
監視状況をIEウィンドウに表示します。これを閉じると監視スクリプトも終了します。
« 「ソースの表示」ウィンドウがIEの後ろに隠れる。(障害) | トップページ | 「ソースの表示」ウィンドウがIEの後ろに隠れる。(その3) »