20090416_006_005


===

txt_File01 = "file001.txt"
txt_File02 = "file002.txt"
txt_File03 = "file003.txt"

s_txt001 = "ttp://www.yourfilehost.com/"
s_txt002 = "http://"

s_len_txt001 = len(s_txt001)
s_len_txt002 = len(s_txt002)

'WScript.Echo s_len_txt001 & vbCrLf
'WScript.Echo s_len_txt002 & vbCrLf


Set objFso01 = CreateObject("Scripting.FileSystemObject")
'Set objFile01 = objFso01.OpenTextFile("C:\Documents and Settings\parao\My Documents\w\a.txt", 1, False)

Set objFile01 = objFso01.OpenTextFile("C:\Documents and Settings\user\My Documents\w\" & txt_File01, 1, False)

If Err.Number > 0 Then
    WScript.Echo "Open Error"
Else
    Do Until objFile01.AtEndOfStream
        'WScript.Echo objFile01.ReadLine & vbCrLf
        txt01 = objFile01.ReadLine & vbCrLf


Set objFso02 = CreateObject("Scripting.FileSystemObject")

'Set objFile02 = objFso02.OpenTextFile("C:\Documents and Settings\user\My Documents\w\" & txt_File02, 1, False)

Set objFile02 = objFso02.OpenTextFile("C:\Documents and Settings\user\My Documents\w\" & txt_File02, 2, True)


Dim s

url_Val01 = "ttp://www.yourfilehostdb.com/"
url_Val02 = "ttp://www.yourfilehost.com/media.php?cat=video&file=nagasawasentai_part002.wmv"

url_Val02 = txt01

'対象画面を検索、なければ開く(必要に応じ使用してください)
Set xShell = CreateObject("Shell.Application")
win_s = False
For Each Window In xShell.Windows '対象URLが表示されているか?
 If TypeName(Window.Document) = "HTMLDocument" Then
  if Window.Document.url=url_Val01 then
     Set objIE0 = Window '対象URLが表示→その画面を使う
     win_s=true
     exit for
  end if
 end if
next

if win_s=false then '対象URLが非表示→新しく画面を開く

 Set objIE0 = CreateObject("InternetExplorer.Application")
 objIE0.Visible = True
 objIE0.Navigate url_Val01

 Do While objIE0.busy = True
    '空ループだと無駄にCPUを使うので250ミリ秒のインターバルを置く
    WScript.sleep(250)
 Loop

 Do While objIE0.document.readyState <> "complete"
 Loop
end if
'---header end---

'---以下操作コード、必要な部分をコピーしてください---
'objIE0.document.all.q.value=url_Val02 ' text index=2
'objIE0.document.all.Submit.click ' submit Submit ログイン or tags("INPUT").item(4).Click

on error resume next
objIE0.document.form1.yourfilehosturl.value=url_Val02 ' text index=2
'objIE0.document.all.Submit.click ' submit Submit ログイン or tags("INPUT").item(4).Click
objIE0.document.form1.Submit.click ' submit Submit ログイン or tags("INPUT").item(4).Click

 Do While objIE0.busy = True
    '空ループだと無駄にCPUを使うので250ミリ秒のインターバルを置く
    WScript.sleep(250)
 Loop

 Do While objIE0.document.readyState <> "complete"
 Loop

'①表示したページの<BODY>部のHTMLを取得し画面に表示
strBody = objIE0.Document.Body.InnerHtml
'WScript.echo strBody

'②表示したページの<BODY>部のテキストだけを取得し画面に表示
strBody = objIE0.Document.Body.InnerText
WScript.echo strBody


objFile02.WriteLine "aaa " & vbcrlf &  vbcrlf & objIE0.Document.Body.InnerText

objFile02.Close
Set objFile02 = Nothing
Set objFso02 = Nothing

'オブジェクトの破棄
Set objIE0 = Nothing


Set objFso02 = CreateObject("Scripting.FileSystemObject")
Set objFile02 = objFso02.OpenTextFile("C:\Documents and Settings\user\My Documents\w\" & txt_File02, 1, False)

Set objFso03 = CreateObject("Scripting.FileSystemObject")
Set objFile03 = objFso03.OpenTextFile("C:\Documents and Settings\user\My Documents\w\" & txt_File03, 8, True)


    flg_01 = "0"
    'WScript.Echo "flg_01 = " & flg_01 & vbCrLf
    'WScript.Echo flg_01 & vbCrLf

    Do Until objFile02.AtEndOfStream

     s01 = objFile02.ReadLine

     'objFile03.WriteLine s01

'     if mid(s01,1,s_len_txt001 - 1) = s_txt001 then
     if mid(s01,1,28) = s_txt001 then
        flg_01 = "1"
        objFile03.WriteLine s01
        'WScript.Echo flg_01 & vbCrLf
     end if

     if flg_01 = "1" and mid(s01,1,7) = s_txt002 then
        objFile03.WriteLine s01
     end if

    Loop
    flg_01 = "0"


objFile02.Close
Set objFile02 = Nothing
Set objFso02 = Nothing

objFile03.Close
Set objFile03 = Nothing
Set objFso03 = Nothing

    Loop
End If

objFile01.Close
Set objFile01 = Nothing
Set objFso01 = Nothing


 


===

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2009年04月16日 20:19
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。