Dim s Set Fs = WScript.CreateObject("Scripting.FileSystemObject") Set oTs1 = Fs.OpenTextFile("ad1.txt",1) 'ファイルを読み取りモードで開く Set oTs2 = Fs.OpenTextFile("twittCeleb.htm",2,true) oTs2.WriteLine "<html>" oTs2.WriteLine "<title>Twitterツィッター有名人ランキング</title>" oTs2.WriteLine "<meta name=""keywords"" content=""twitter,ヤフオク,オークション,ツィッター,DVD,ランキング""><head>"
Line=0 total=0 adTxt="" Do Until oTs1.AtEndOfStream 'oTs1を末端まで読み込むまでループを繰り返す sLine = oTs1.ReadLine '1行読み込む oTs2.WriteLine sLine adTxt=adTxt & sLine & "<br>" Loop oTs1.Close Set objIEx = CreateObject("InternetExplorer.application") objIEx.Navigate "about:blank"
objIEx.StatusText = t_date & " htm作成中" objIEx.ToolBar = false objIEx.MenuBar = false '対象画面を検索、なければ開く(必要に応じ使用してください) 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="http://www.talenttwitter.com/tllink/tllink.php?mode=rank" 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 "http://www.talenttwitter.com/tllink/tllink.php?mode=rank" waitPage (objIE0) end if Set sIE = CreateObject("InternetExplorer.Application") sIE.Visible = True s = objIE0.document.body.innerhtml 'do until instr(s,">次ページ")=0 np=true do until np=false np=false x=0 do until x=-1 For i = 0 To objIE0.document.links.Length - 1 hr=objIE0.document.links(i).href if instr(hr,"http://www.talenttwitter.com/tllink/tllink.php?mode=jump&id=")>0 then sIE.Navigate hr waitPage (sIE) twitUrl="http://twitter.com/" & strmid(sIE.locationurl,"view/",".html") sIE.Navigate twitUrl objIEx.Document.Write objIE0.document.links(i).href & "**" & objIE0.document.links(i).outertext & "<br>" waitPage (sIE) follow=false oTs2.WriteLine "<A href=""" & twitUrl & """>" & objIE0.document.links(i).outertext &"</a><br>" For ii = 0 To objIE0.document.links.Length - 1 if instr(objIE0.document.links(ii).innerHtml,"</SPAN>をフォロー</A>")>0 then objIE0.document.links(ii).click objIEx.Document.Write "フォロー<br>" follow=true exit for end if next if follow=false then objIEx.Document.Write "フォロー済み???<br>" end if end if if instr(objIE0.document.links(i).outertext,"次ページ >>")>0 then objIE0.document.links(i).click objIEx.Document.Write objIE0.document.links(i).href & " np<br>" np=true waitPage (objIE0) exit for end if 'objIEx.Document.Write objIE0.document.links(i).href & "**" & objIE0.document.links(i).outertext & "<br>" next if np=false then objIEx.Document.Write "np nasi<br>" ' x=link_click(objIE0, "href_inc","http://www.talenttwitter.com/view/",false) ' sIE.Navigate x waitPage (sIE) loop 'xx=link_click(objIE0, "text_inc", "次ページ",true) s = objIE0.document.body.innerhtml loop oTs2.WriteLine "</body></html>" oTs2.Close Function link_click(objIE, typ, v,click) link_click = -1 if typ="num" then objIE.document.links(v).Click Call ie_wait(objIE) link_click = 0 else For i = 0 To objIE.document.links.Length - 1 If typ = "text_inc" Then If instr(objIE.document.links(i).outertext,v) Then objIE.document.links(i).Click Call waitPage(objIE) link_click = 0 Exit For End If End If If typ = "text" Then If objIE.document.links(i).outertext = v Then objIE.document.links(i).Click Call waitPage(objIE) link_click = 0 Exit For End If End If If typ = "href" Then If objIE.document.links(i).href = v Then objIE.document.links(i).Click Call waitPage(objIE) link_click = 0 Exit For End If End If If typ = "href_inc" Then If InStr(objIE.document.links(i).href, v) > 0 Then if click=true then objIE.document.links(i).Click Call waitPage(objIE) end if link_click = objIE.document.links(i).href Exit For End If End If Next end if End Function Function strmid(org,mae,usiro) pos = InStr(org, mae) If pos > 0 Then strmid = Right(org, Len(org) - pos - Len(mae) + 1) org = strmid pos = InStr(strmid, usiro) If usiro = "" Then ' strmid = "" Else If pos > 0 Then strmid = Left(strmid, pos - 1) End If End If Else strmid = "" End If End Function Sub waitPage (objIE) Do While objIE.busy Loop Do While objIE.Document.readyState <> "complete" Loop End Sub