coca22coca
Goto Top

HTML Output in eine txt Datei mit VisualBasicScript

Ich habe ein html link der eine Seite öffnet, doch der Output der da raus kommt möchte ich in eine Textdatei schreiben. Geht das in vbs und wenn ja, könnte mir das jemand erklären, Bitte. Danke
Wenn jemand einen anderen Weg kennt, ich bin für Vorschläge offen.

Content-Key: 322622

Url: https://administrator.de/contentid/322622

Printed on: May 5, 2024 at 01:05 o'clock

Member: emeriks
emeriks Dec 01, 2016 at 19:16:18 (UTC)
Goto Top
Dazu gibt's im Web zig Beiträge.
vbscript read html webpage text
Mitglied: 131381
131381 Dec 02, 2016 updated at 16:17:49 (UTC)
Goto Top
result = DownloadFile("https://administrator.de","D:\daten\administrator-webpage.txt")  

if result then
    msgbox "Download erfolgreich abgeschlossen"  
else
    msgbox "Download-Fehler!",vbExclamation  
End if

Function DownloadFile(strURL, strTarget)
    Dim objhttp,objStream
    Set objhttp = CreateObject("Microsoft.XMLHTTP")  
    Set objStream = CreateObject("ADODB.Stream")  
    With objhttp
        .Open "GET", strURL, False  
        .send
        If .Status = 200 Then
            objStream.Open
            objStream.Type = 1
            objStream.Write .responseBody
            objStream.SaveToFile strTarget, 2
            objStream.Close
            DownloadFile = True
        Else
            DownloadFile = False
        End If
    End With
End Function
Gruß