logo       

[ruby-list:41134] Re: win32oleで作成したIEの子ウィンドウの取得: msg#00053

lang.ruby.japanese

Subject: [ruby-list:41134] Re: win32oleで作成したIEの子ウィンドウの取得

助田です。

In message "[ruby-list:41128] win32oleで作成したIEの子ウィンドウの取得"
on 05/09/11, Hidenori Hashizume
<hide-tech-ZQFY+njjMBnpVH8W3JqS+w@xxxxxxxxxxxxxxxx> writes:

>  win32oleで作成したInternet Explorerのウィンドウの子ウィンドウへの参照
> を取得する方法は無いでしょうか。

子ウィンドウへの参照を取得する方法は、わからなかったのですが、
Shell.Application を使ってみる方法じゃ駄目でしょうか?

---- Ruby スクリプト -----
'win32ole'

ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = true
ie.Navigate("http://localhost/test01.html";)
while(ie.busy)
sleep 3
end

#
# ここで適当に少しだけsleepしないと、test01.htmlから
# onloadイベントで開かれるウェブブラウザが
# shell.Windowsでリストアップされない。
#
sleep 1

shell = WIN32OLE.new("Shell.Application")
windows = shell.Windows
windows.each do |w|
if w.document.ole_type.name == 'DispHTMLDocument'
puts w.busy
puts w.locationURL
end
end
---------------------------

---- test01.html ----
<html>
<head>
<title>test01.html</title>
<Script Language="javascript">
<!--
function open_window() {
window.open('http://www.google.com')
}
-->
</Script>
</head>
<body onload="open_window()">
Open new window and access to Google site.
</body>
</html>
----------------------






<Prev in Thread] Current Thread [Next in Thread>
Related Threads on FossPlanet: