ruby学习系列--操作htmlfile对象

1 require 'win32ole'
2 
3    a = WIN32OLE.new('htmlfile')
4    methods = a.ole_methods.select { |m| m.visible? }
5    methods.each do |meth|
6        puts "#{meth.name}(" +meth.params.map {|p| "#{p.ole_type} #{p.name}" }.join(''+ ")"
7    end
8 

 

 

输出内容如下:

>ruby 本文件.rb
all()
body()
activeElement()
images()
applets()
links()
forms()
anchors()
title()
title()
scripts()
selection()
readyState()
frames()
embeds()
plugins()
alinkColor()
alinkColor()
bgColor()
bgColor()
fgColor()
fgColor()
linkColor()
linkColor()
vlinkColor()
vlinkColor()
referrer()
location()
lastModified()
url()
url()
domain()
domain()
cookie()
cookie()
defaultCharset()
defaultCharset()
mimeType()
fileSize()
fileCreatedDate()
fileModifiedDate()
fileUpdatedDate()
security()
protocol()
nameProp()
write(VARIANT psarray)
writeln(VARIANT psarray)
open(BSTR url, VARIANT name, VARIANT features, VARIANT replace)
close()
clear()
queryCommandSupported(BSTR cmdID)
queryCommandEnabled(BSTR cmdID)
queryCommandState(BSTR cmdID)
queryCommandIndeterm(BSTR cmdID)
queryCommandText(BSTR cmdID)
queryCommandValue(BSTR cmdID)
execCommand(BSTR cmdID, BOOL showUI, VARIANT value)
execCommandShowHelp(BSTR cmdID)
createElement(BSTR eTag)
onhelp()
onhelp()
onclick()
onclick()
ondblclick()
ondblclick()
onkeyup()
onkeyup()
onkeydown()
onkeydown()
onkeypress()
onkeypress()
onmouseup()
onmouseup()
onmousedown()
onmousedown()
onmousemove()
onmousemove()
onmouseout()
onmouseout()
onmouseover()
onmouseover()
onreadystatechange()
onreadystatechange()
onafterupdate()
onafterupdate()
onrowexit()
onrowexit()
onrowenter()
onrowenter()
ondragstart()
ondragstart()
onselectstart()
onselectstart()
elementFromPoint(I4 x, I4 y)
parentWindow()
styleSheets()
onbeforeupdate()
onbeforeupdate()
onerrorupdate()
onerrorupdate()
toString()
createStyleSheet(BSTR bstrHref, I4 lIndex)
releaseCapture()
recalc(BOOL fForce)
createTextNode(BSTR text)
documentElement()
attachEvent(BSTR event, DISPATCH pdisp)
detachEvent(BSTR event, DISPATCH pdisp)
onrowsdelete()
onrowsdelete()
onrowsinserted()
onrowsinserted()
oncellchange()
oncellchange()
ondatasetchanged()
ondatasetchanged()
ondataavailable()
ondataavailable()
ondatasetcomplete()
ondatasetcomplete()
onpropertychange()
onpropertychange()
dir()
dir()
oncontextmenu()
oncontextmenu()
onstop()
onstop()
createDocumentFragment()
onbeforeeditfocus()
onbeforeeditfocus()
getElementsByName(BSTR v)
getElementById(BSTR v)
getElementsByTagName(BSTR v)
focus()
hasFocus()
onselectionchange()
onselectionchange()
namespaces()
createDocumentFromUrl(BSTR bstrUrl, BSTR bstrOptions)
media()
media()
CreateEventObject(VARIANT pvarEventObject)
FireEvent(BSTR bstrEventName, VARIANT pvarEventObject)
createRenderStyle(BSTR v)
oncontrolselect()
oncontrolselect()
URLUnencoded()
onmousewheel()
onmousewheel()
doctype()
implementation()
createAttribute(BSTR bstrattrName)
createComment(BSTR bstrdata)
onfocusin()
onfocusin()
onfocusout()
onfocusout()
onactivate()
onactivate()
ondeactivate()
ondeactivate()
onbeforeactivate()
onbeforeactivate()
onbeforedeactivate()
onbeforedeactivate()
compatMode()
nodeType()
parentNode()
hasChildNodes()
childNodes()
attributes()
insertBefore(IHTMLDOMNode newChild, VARIANT refChild)
removeChild(IHTMLDOMNode oldChild)
replaceChild(IHTMLDOMNode newChild, IHTMLDOMNode oldChild)
cloneNode(BOOL fDeep)
removeNode(BOOL fDeep)
swapNode(IHTMLDOMNode otherNode)
replaceNode(IHTMLDOMNode replacement)
appendChild(IHTMLDOMNode newChild)
nodeName()
nodeValue()
nodeValue()
firstChild()
lastChild()
previousSibling()
nextSibling()
ownerDocument()
>Exit code: 0

posted @ 2010-08-03 18:47  赵献良  阅读(649)  评论(0编辑  收藏  举报