# rtfToTxt.rb # Ruby script for batch running Word macros require 'win32ole' # Launch new instance of Word wrd = WIN32OLE.new('Word.Application') wrd.Visible = 1 # First argument to script is the name of the macro macro_to_run = ARGV.shift() # Everything else is a document on which to run the macro ARGV.each do |file| doc = wrd.Documents.Open(File.expand_path(file)) wrd.Run(macro_to_run) doc.Close() end wrd.Quit()