htmlファイルにbaseタグを追加する。(その2)
htmlファイルをドロップすると、baseタグとMOTWを追加します。urlはieのアクティブタブから取ってきます。
base.vbs htmlファイル
function fold40(byval s)
do while len(s)
fold40=fold40 & left(s,40) & " "
s=mid(s,41)
loop
end function
Set Shell=CreateObject("Shell.Application")
Randomize
For Each ie In Shell.Windows
If LCase(Right(ie.FullName,13))="\iexplore.exe" Then
r=CStr(Rnd)
ie.StatusText=r
If ie.StatusText=r Then
url=ie.LocationURL
url=InputBox(ie.LocationName & vbLf & fold40(url),"Is this URL OK ?. Or Enter URL",url)
If url<>"" Then
ie.StatusText=""
Exit For
End If
End If
ie.StatusText=""
End If
Next
If url="" Then url=InputBox("Default URL","Is this URL OK ?. Or Enter URL","http://www.microsoft.com")
If url="" then wscript.quit
set dst=createobject("adodb.stream")
dst.open
dst.type=2
dst.charset="iso-8859-1"
dst.writetext "<!-- saved from url=(" & mid(10000+Len(Url),2)& ")" & Url & " -->",1
dst.writetext "<HTML><HEAD><BASE HREF=""" & Url & """></HEAD></HTML>",1
dst.position=0
dst.type=1
dst.position=dst.size
set src=createobject("adodb.stream")
src.open
src.type=1
src.loadfromfile wscript.arguments.item(0)
src.copyto dst
dst.savetofile wscript.arguments.item(0),2
« htmlファイルにbaseタグを追加する。 | トップページ | セキュリティレベルに依存して実行できないBookmarkletを実行する。(その2) »