igor_andreev
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: 'сохранить как... strFile = "C:\anekdot.html" 'адрес страницы в инете strURL="http://anekdotov.net/anekdot/random/2.html" On Error Resume Next Set objHTTP = CreateObject("MSXML2.XMLHTTP") Call objHTTP.Open("GET", strURL, False) objHTTP.Send Set fso = CreateObject("Scripting.FileSystemObject") Set flink = fso.OpenTextFile(strFile, 2, True) flink.Write objHTTP.ResponseText flink.Close If Err<>0 Then WScript.Quit Set objHTTP = Nothing Set fso = Nothing WScript.Quit | Код: 'адрес страницы в инете strURL = "http://anekdotov.net/anekdot/random/1.html" 'сохранить как... strFile = "C:\anekdot.txt" strText = TextFromHTML( strURL ) Set fso = CreateObject("Scripting.FileSystemObject") Set fileHandle = fso.CreateTextFile( strFile, True ) fileHandle.Write strText fileHandle.Close 'функция выдирания чистого текста со страницы, без html-тегов Function TextFromHTML( URL ) Set objIE = CreateObject( "InternetExplorer.Application" ) objIE.Navigate URL Do Until objIE.ReadyState = 4 WScript.Sleep 100 Loop TextFromHTML = objIE.Document.Body.InnerText objIE.Quit End Function WScript.Quit | |