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

Ausgedruckt am: 19.03.2024 um 07:03 Uhr

Mitglied: emeriks
emeriks 01.12.2016 um 20:16:18 Uhr
Goto Top
Dazu gibt's im Web zig Beiträge.
vbscript read html webpage text
Mitglied: 131381
131381 02.12.2016 aktualisiert um 17:17:49 Uhr
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ß