Macro/投稿/66
をテンプレートにして作成
Land.to
[
ホーム
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
* テキストブラウザ(use IE Ojbect) [#ebff5b89]
-ページ: [[Macro/投稿]]
-作者: [[(全略)]]
-カテゴリー: vbs
-投稿日: 2005-09-06 (火) 00:07:56
** メッセージ [#x73cd06f]
#code(vbscript){{
'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 ...
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 & "--------------------------------------...
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, ...
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, ...
If indent <> "" Then get_html = get_html & vb...
End Select
Next
End Function
}}
----
#comment
終了行:
* テキストブラウザ(use IE Ojbect) [#ebff5b89]
-ページ: [[Macro/投稿]]
-作者: [[(全略)]]
-カテゴリー: vbs
-投稿日: 2005-09-06 (火) 00:07:56
** メッセージ [#x73cd06f]
#code(vbscript){{
'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 ...
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 & "--------------------------------------...
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, ...
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, ...
If indent <> "" Then get_html = get_html & vb...
End Select
Next
End Function
}}
----
#comment
ページ名: