IE7/IE8で、現在または最後にアクティブなIEを捕捉する。(その2)
WSHから現在または最後にアクティブなIEを捕捉します。
GetCurrentIE.vbs
Set wShell=CreateObject("WScript.Shell")
If wShell.AppActivate(" - Windows Internet Explorer") Then
wShell.SendKeys "^{f6}"
For Each ie In CreateObject("Shell.Application").Windows()
If ie.ReadyState=4 Then If TypeName(ie.Document)="HTMLDocument" Then If ie.Document.hasFocus() Then Exit For
Next
End If
If IsEmpty(ie) Then
MsgBox "Not Found"
Else
MsgBox ie.LocationURL
End If
AppActivate(" - Windows Internet Explorer")で、現在または最後にアクティブなIEをアクティブにし、SendKeys "^{f6}"で、HTMLDocumentのペインにフォーカスを移動します。これを判定します。
« Vista IEで、「Web ページ、HTML のみ (*.htm;*.html)」で「名前を付けて保存」する。 | トップページ | Vista以降で、アクティブなシェルを捕捉する。(その2) »