[ruby-talk:02593] Re: Ruby and WSH

From: Andrew Hunt <andy@...>
Date: 2000-04-27 16:04:09 UTC
List: ruby-talk #2593
    Hal says:
    >Anyway, I was just thinking that a Ruby interface would
    >be a good project for someone knowledgeable about such
    >things.
    

Check out WIN32OLE from the archives, it uses the 
Windows Scipting Host stuff:

#
# You need WSH(Windows Scripting Host) to run this script.
#

require "win32ole"

def listup(items)
#  items.each do |i|
  for i in items
    puts i.name 
  end
end

fs = WIN32OLE.new("Scripting.FileSystemObject")

folder = fs.GetFolder(".")

puts "--- folder of #{folder.path} ---"
listup(folder.SubFolders)

puts "--- files of #{folder.path} ---"
listup(folder.Files)


/\ndy


--
Andrew Hunt, The Pragmatic Programmers, LLC.
Innovative Object-Oriented Software Development
web:   http://www.pragmaticprogrammer.com   email: andy@pragmaticprogrammer.com
--
Our New Book: "The Pragmatic Programmer" Published by Addison-Wesley Oct 1999
              (see www.pragmaticprogrammer.com/ppbook)
--

In This Thread

Prev Next