IE7/IE8で、アクティブなIEを捕捉する。
IEの「お気に入りセンタ」か「お気に入りバー」から起動すれば、そのウィンドウのアクティブタブのIEを捕捉します。
GetCurrentIE.vbs
Set ies=CreateObject("Shell.Application").Windows()
For Each ie In ies
If ie.ReadyState=4 Then If TypeName(ie.Document)="HTMLDocument" Then If ie.Document.hasFocus() Then Exit For
Next
If IsEmpty(ie) Then
For Each ie In ies
If ie.ReadyState<>4 Then
ElseIf TypeName(ie.Document)="HTMLDocument" Then
ie.Document.focus
If ie.Document.hasFocus() Then Exit For
End If
Next
End If
If IsEmpty(ie) Then
MsgBox "Not Found"
Else
MsgBox ie.LocationURL,,ie.Document.title
End If
※ スクリプトファイル(またはそのショートカット)は他で作って、「お気に入り」か「お気に入りバー」に「移動」で入れること。
※ ウィンドウのフォアグラウンドロックを利用しているので、フォアグラウンドロックを無効(タイムアウト値を0)にしていると使えません。
« IEのFORMへの入力がESCキーで消えるのを防止する。 | トップページ | Vistaのエクスプローラには「リンクバー」がない。「上へ」ボタンもない。 »