Vbscript网站内容,SelectAll复制和过去到记事本*帮助*

时间:2015-12-25 04:53:34

标签: vbscript

我得到了将网站内容复制到记事本中的代码:

    With CreateObject("InternetExplorer.Application")
    .Visible = False
    .Navigate "https://example.com"
    Do Until .ReadyState = 4
        Wscript.Sleep 100
    Loop
    For Each Tag In .Document.GetElementsByTagName("script")
        Tag.OuterHtml = ""
    Next
    For Each Tag In .Document.GetElementsByTagName("noscript")
        Tag.OuterHtml = ""
    Next
    Content = .Document.GetElementsByTagName("body")(0).InnerText
    Do While InStr(Content, vbCrLf & vbCrLf)
        Content = Replace(Content, vbCrLf & vbCrLf, vbCrLf)
    Loop
    ShowInNotepad Content
    .Quit
End With

Sub ShowInNotepad(Content)
    With CreateObject("Scripting.FileSystemObject")
        TempPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%TEMP%") & "\" & .GetTempName
        With .CreateTextFile(TempPath, True, True)
            .WriteLine (Content)
            .Close
        End With
        CreateObject("WScript.Shell").Run "notepad.exe " & TempPath, 1, True
        .DeleteFile (TempPath)
    End With
End Sub

我坚持使用上面的脚本将文本保存为file.txt。

请帮忙。

1 个答案:

答案 0 :(得分:0)

尝试类似的东西:

@IBOutlet var countView: UIView!