Forum: Ruby win32ole

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
15bd868c6ec4b6f76ce64a61d4e42d25?d=identicon&s=25 yeungsprite (Guest)
on 2006-04-25 21:05
Hello, I am new to Ruby and Windows programming and have a question
regarding the WIN32OLE.  The following sample code is used to launch MS
Internet Explorer.

require 'win32ole'
ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = true
ie.gohome

What I would like to do is launch MS Windows Explorer (file manager /
Windows GUI Shell) and determine the functions to call to traverse it
(ie expand branches, open files, etc) for automation purposes.

Can anyone suggest resources on how to accomplish this?

Thanks very much!
Bfa670ef2303deb7dec5a8027367b30b?d=identicon&s=25 Mully (Guest)
on 2006-04-25 23:52
yeungsprite wrote:
> Hello, I am new to Ruby and Windows programming and have a question
> regarding the WIN32OLE.  The following sample code is used to launch MS
> Internet Explorer.
>
> require 'win32ole'
> ie = WIN32OLE.new('InternetExplorer.Application')
> ie.visible = true
> ie.gohome
>
> What I would like to do is launch MS Windows Explorer (file manager /
> Windows GUI Shell) and determine the functions to call to traverse it
> (ie expand branches, open files, etc) for automation purposes.
>
> Can anyone suggest resources on how to accomplish this?
>
> Thanks very much!

The Windows Shell object may serve your purpose and is accessible via
COM (win32ole). A simple example:

ws = WIN32OLE.new("Shell.Application")
folder = ws.NameSpace("C:\\Temp")
folder.Items.each do |f|
	puts f.Name, f.Type, f.Size
end

Search msdn.microsoft.com for "Scriptable Shell Objects" for more
details.

Mully
This topic is locked and can not be replied to.