2010/09/09 Windows7 で動作確認 ブラウザでダウンロード VBScript で HTML を書き出すShell オブジェクトは、一般的な目的で利用する事は少ないですが、 パッチ処理にはなにかと助けになってくれます。 この一覧は、ただ見るだけですが、本来は VC++ で作成したデスクトップの アイコンの位置情報と共に「保存可能な実体を持つファイル」を判断する為に使います bFlg = True ' 必要なオブジェクト Set Fs = CreateObject( "Scripting.FileSystemObject" ) Set WshShell = CreateObject( "WScript.Shell" ) Set Shell = CreateObject( "Shell.Application" ) ' ファイル strPath = "Desktop_info.htm" Set OutFile = Fs.OpenTextFile( strPath, 2, True ) ' HTML 骨格部分 OutFile.WriteLine "<HTML><HEAD><TITLE>ProcessList</TITLE>" OutFile.WriteLine "<META http-equiv=""Content-Type"" content=""text/html; charset=shift_jis"">" OutFile.WriteLine "<STYLE type=""text/css"">* { font-size:12px;}</STYLE>" OutFile.WriteLine "</HEAD><BODY>" OutFile.WriteLine "<TABLE>" OutFile.WriteLine "<TR>" OutFile.WriteLine "<TH style='background-color:gray;color:white' nowrap></TH>" OutFile.WriteLine "<TH style='background-color:gray;color:white' nowrap>名称</TH>" OutFile.WriteLine "<TH style='background-color:gray;color:white' nowrap>タイプ</TH>" OutFile.WriteLine "<TH style='background-color:gray;color:white' nowrap>パス</TH>" if bFlg then OutFile.WriteLine "<TH style='background-color:gray;color:white' nowrap>説明</TH>" end if OutFile.WriteLine "</TR>" ' デスクトップ Set objFolder = Shell.NameSpace( 0 ) ' アイテムコレクション Set objFolderItems = objFolder.Items() ' HTML データ部分 nCnt = 0 For Each item in objFolderItems OutFile.WriteLine "<TR>" strCss = "" if nCnt Mod 2 = 0 then strCss = "style='background-color:#D0D0D0;'" end if ' 連番 OutFile.WriteLine "<TD nowrap " & strCss & "><B>" & (nCnt + 1) & "</b></TD>" ' 詳細データ OutFile.WriteLine "<TD nowrap " & strCss & "><B>" & objFolder.GetDetailsOf(item, 0) & "</b></TD>" OutFile.WriteLine "<TD nowrap " & strCss & ">" & objFolder.GetDetailsOf(item, 2) & "</TD>" OutFile.WriteLine "<TD nowrap " & strCss & ">" & item.Path & "</TD>" if bFlg then on error resume next OutFile.WriteLine "<TD nowrap " & strCss & ">" & objFolder.GetDetailsOf(item, -1) & "</TD>" if Err.Number <> 0 then OutFile.WriteLine "<TD nowrap " & strCss & "></TD>" end if on error goto 0 end if OutFile.WriteLine "</TR>" nCnt = nCnt + 1 Next OutFile.WriteLine "</TABLE></BODY></HTML>" OutFile.Close WshShell.Run( "RunDLL32.EXE shell32.dll,ShellExec_RunDLL """ & _ WshShell.CurrentDirectory & "\" & strPath & """" ) |