2003/10/17
微妙すくりぷと
必要な物
すくりぷと
require "Win32API"
require "win32ole"
module SIPC
Connect = Win32API.new("sipc.dll", "Connect", ["P"], "I")
Disconnect = Win32API.new("sipc.dll", "Disconnect", [], "I")
Send = Win32API.new("sipc.dll", "Send", ["P", "P", "I"], "I")
module_function
def send(command)
buf = "" * 1024
Connect .call("rubysample")
Send .call(command, buf, buf.size)
Disconnect .call()
buf.delete!("")
buf
end
end
xml = WIN32OLE .new("Microsoft.XMLDOM")
xml.async = false
xml.load("http://slashdot.jp/slashdot.rdf")
text = ""
items = xml.getElementsByTagName("item")
items .length .times do |i|
item = items.item(i)
title = item .getElementsByTagName("title") .item(0) .text
link = item .getElementsByTagName("link") .item(0) .text
text < < title << "<n>"
text << link << "<n>"
end
SIPC.send("say #{text}")
微妙な点