[最終更新日などの情報を取得する]
http://www.whitire.com に接続してページの情報を取得します。
【ソースコード】
[tips0162.vbs]
Option Explicit
On Error Resume Next
Dim strUrl
Dim objIE
Dim objDoc
strUrl = "http://www.whitire.com/"
Set objIE = WScript.CreateObject("InternetExplorer.Application")
If Err.Number = 0 Then
objIE.Navigate strUrl
Do While objIE.busy
WScript.Sleep(100)
Loop
Do While objIE.Document.readyState <> "complete"
WScript.Sleep(100)
Loop
Set objDoc = objIE.Document
WScript.Echo "Title: " & objDoc.Title
WScript.Echo "Location: " & objDoc.Location
WScript.Echo "Url: " & objDoc.Url
WScript.Echo "LastModified: " & objDoc.LastModified
WScript.Echo "FileModifiedDate: " & objDoc.FileModifiedDate
WScript.Echo "FileSize: " & objDoc.FileSize
Else
WScript.Echo "エラー:" & Err.Description
End If
Set objIE = Nothing
【実行結果】
C:\> cscript //NoLogo tips0162.vbs
Title: Whitire's HomePage
Location: http://www.whitire.com/
Url: http://www.whitire.com/
LastModified: 03/15/2005 21:49:34
FileModifiedDate: 03/15/2005
FileSize: 2458