Macro/投稿/66

http://sakura.qp.land.to/?Macro%2F%C5%EA%B9%C6%2F66


Top > Macro > 投稿 > 66

テキストブラウザ(use IE Ojbect)

  • ページ: Macro/投稿
  • 作者: (全略)?
  • カテゴリー: vbs
  • 投稿日: 2005-09-06 (火) 00:07:56

メッセージ

  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
'TextBrowser.vbs
Dim uri
uri = Editor.GetSelectedString(0)
If uri = "" Then
    uri = "http://www.yahoo.co.jp/"
Else
    If Left(uri, 7) <> "http://" And InStr(uri, "/") > 0 Then
        Editor.GoFileTop()
        Editor.GoLineEnd_Sel(0)
        uri = Right(uri, Len(uri) - InStr(uri, "/"))
        uri = Editor.GetSelectedString(0) & uri
    End If
End If
 
Editor.SelectAll()
Editor.InsText(uri & " を読み込み中...")
Editor.GoFileTop()
Editor.ReDraw()
 
Dim ie
Set ie = CreateObject("InternetExplorer.Application")
 
If Not ie Is Nothing Then
    ie.Visible = False
    ie.Navigate(uri)
 
    Do While ie.Busy
    Loop
 
    Dim body
 
    body = uri & vbCrLf
    body = body & ie.document.title & vbCrLf
    body = body & "------------------------------------------------------------" & vbCrLf
    body = body & get_html(ie.Document.Body.childNodes, "")
 
    Editor.SelectAll()
    Editor.InsText(body)
    Editor.GoFileTop()
    Editor.ReDraw()
 
    ie.Quit()
End If
 
Function get_html(ByVal document, ByVal margin)
    Dim v
 
    For Each v In document
 
        Select Case TypeName(v)
        Case "DispHTMLDOMTextNode":
            Dim dv, prev_dv
            dv = Trim(v.data)
            Do
                prev_dv = dv
                dv      = Replace(dv, "  ", " ")
            Loop While dv <> prev_dv
 
            If dv <> "" Then get_html = get_html & dv
        Case "HTMLAnchorElement":
            get_html = get_html & get_html(v.childNodes, margin)
            get_html = get_html & "<""" & v.href & """>"
        Case Else:
            Dim indent
            indent = ""
 
            Select Case v.tagName
            Case "P", "DIV", "TABLE", "TR":
                indent = Space(2)
                get_html = get_html & vbCrLf & margin
            End Select
 
            get_html = get_html & get_html(v.childNodes, margin & indent)
 
            If indent <> "" Then get_html = get_html & vbCrLf
        End Select
    Next
End Function


URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White

リロード   新規 編集 凍結 差分 添付 複製 名前変更   ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: 2006-07-30 (日) 00:41:04 (6473d)