Vista IEで、「Web ページ、完全 (*.htm;*.html)」で「名前を付けて保存」する。
IE7以降で「Web ページ、完全 (*.htm;*.html)」で保存しようとしても、デフォルトが「Web アーカイブ、単一のファイル (*.mht)」なので、これをいちいち変更しなければなりません。面倒臭。
IE7でShell.Windows().Item()が使えなくなったので、コンテキストメニュー拡張に変更しましたが、Vistaで「保護モード:有効」のページからのコンテキストメニュー拡張でActiveXObjectが使えなくなったため、再度、WSH起動に変更します。
IEの「お気に入りセンタ」か「お気に入りバー」から起動します。
Web ページ、完全.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"
WScript.Quit
End If
Set fso=CreateObject("Scripting.FileSystemObject")
title=ie.Document.title
If title="" Then
title=fso.GetFileName(ie.Document.location.pathname)
End If
Select Case fso.GetExtensionName(title)
Case "htm","html"
Case Else
title2=ie.Document.title
ie.Document.title=title & ".htm"
End Select
ie.ExecWB 4,1
If Not IsEmpty(title2) Then ie.Document.title=title2
※ スクリプトファイル(またはそのショートカット)は他で作って、「お気に入り」か「お気に入りバー」に「移動」で入れること。
※ ウィンドウのフォアグラウンドロックを利用しているので、フォアグラウンドロックを無効(タイムアウト値を0)にしていると使えません。
« Vista IEの「保護モード:有効」のページでは、MenuExtからActiveXObjectが使えない? | トップページ | Vista IEで、「Web ページ、HTML のみ (*.htm;*.html)」で「名前を付けて保存」する。 »