' **************************************************************** ' 【exBrowserSleipnir / 「別ブラウザ表示」スクリプトインストーラ】 ' ' 使用方法はReadme.txtを参照。 ' **************************************************************** Option Explicit Dim cMsg, fPath, Fso, objSrvHTTP, strPath ' *********************************** ' インストール確認 ' *********************************** cMsg = Msgbox("Sleipnirのスクリプトへ「別ブラウザ表示」を追加します。" _ & VbCrLf & "よろしいですか?", VbYesNo, "exBrowser") If cMsg = VbNo Then Wscript.Quit End If ' *********************************** ' フォルダ存在チェック ' *********************************** fPath = "C:\Program Files\Fenrir & Co\Sleipnir\scripts\別ブラウザ表示" Set Fso = CreateObject( "Scripting.FileSystemObject" ) If Not Fso.FolderExists(fPath) Then ' 無ければ作成 Fso.CreateFolder(fPath) End If ' ダウンロード処理 strPath = "http://holmes21.usamimi.info/inblo/download/exb/script/" Call FileDownload(strPath & "Chrome.vbs", fPath & "\Chrome.vbs") Call FileDownload(strPath & "Firefox.vbs", fPath & "\Firefox.vbs") msgbox("ダウンロードが完了しました") ' *********************************** ' ファイルダウンロード ' *********************************** Sub FileDownload(strUrl, strFile) Dim Stream ' ダウンロード用のオブジェクト Set objSrvHTTP = Wscript.CreateObject("Msxml2.ServerXMLHTTP") ' ダウンロード要求 on error resume next Call objSrvHTTP.Open("GET", strUrl, False ) if Err.Number <> 0 then Wscript.Echo Err.Description Wscript.Quit end if objSrvHTTP.Send if Err.Number <> 0 then ' おそらくサーバーの指定が間違っている Wscript.Echo Err.Description Wscript.Quit end if on error goto 0 if objSrvHTTP.status = 404 then Wscript.Echo "URL が正しくありません(404)" Wscript.Quit end if ' バイナリデータ保存用オブジェクト Set Stream = Wscript.CreateObject("ADODB.Stream") Stream.Open Stream.Type = 1 ' バイナリ ' 戻されたバイナリをファイルとしてストリームに書き込み Stream.Write objSrvHTTP.responseBody ' ファイルとして保存 Stream.SaveToFile strFile, 2 Stream.Close End Sub