# What can you automate with Ruby?

**URL:** <https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889>\
**Category:** Ruby\
**Created:** [September 7, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889 "2006-09-07T17:57:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/1 "2006-09-07T17:57:30Z")

</div>

Hi all,  
I’m a newbie - please have patience.

I am not sure if anyone uses Ruby as an automation tool - I think it  
would be a cool thing to do.

I have heard of the WIN32OLE extension - it sounds cool - does anyone  
use this and why?

I was wondering if this automation only applies to these Windows  
applications or is there any more you can control with a Ruby program?

I use the graphing application Origin - could I use Ruby to automate,  
i.e. put data in and plot graphs.

Thanks in advance,

Chris

---

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/2 "2006-09-07T18:21:30Z")

</div>

Chris F. wrote:

> applications or is there any more you can control with a Ruby program?
> 
> I use the graphing application Origin - could I use Ruby to automate,  
> i.e. put data in and plot graphs.

Let me put it this way. If an automation facility exists that allows the  
behavior of applications to be orchestrated by software, and if the  
facility is reasonably flexible, then Ruby will be able to perform the  
automations.

---

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/3 "2006-09-07T18:27:31Z")

</div>

On 9/7/06, Chris F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> applications or is there any more you can control with a Ruby program?
> 
> I use the graphing application Origin - could I use Ruby to automate,  
> i.e. put data in and plot graphs.
> 
> Thanks in advance,
> 
> Chris

It depends on what you want to automate. Ruby can do (almost) anything  
any other language can - on windows that means COM, commandlines,  
WIN32API, registers, etc.  
You can even automate GUIs via AutoIt .dll/COM interface, although in  
most cases pure AutoIt is easier.

There is watir package to control/automate the browser if I’ve  
understood it correctly.

On unix, the possibilities are similar, so the main question is, what  
means/protocol/whatever you need to use to automate your target?

---

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 6:28pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/4 "2006-09-07T18:28:00Z")

</div>

> If an automation facility exists

Is there a standard way to find out if an application enables  
automation? or can you suggest a way?

> if the  
> facility is reasonably flexible

Could you expand upon this please?

Thankyou  
Chris

---

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 6:49pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/5 "2006-09-07T18:49:34Z")

</div>

Hi Chris,

Coincidentally, I am also a Ruby N., and just found out about  
WIN32OLE. So far, the documentation I’ve found is very spare. One  
trick I did learn in combing through the web was to use your system to  
print out the methods available for the various applications:

require ‘win32ole’

# Win32OLE Variables

excel = WIN32OLE.new(‘Excel.Application’)  
word = WIN32OLE.new(‘Word.Application’)

puts excel.methods  
puts “\n\n”  
puts excel.ole\_methods

puts word.methods  
puts “\n\n”  
puts word.ole\_methods  
puts “\n\n”  
puts word.Documents.ole\_methods

This gave me at least a start. You might also want to look at the help  
file that is available on Office Automation at  
[http://support.microsoft.com/kb/302460/](http://support.microsoft.com/kb/302460/).

If anyone else has any information on Office Automation, and  
specifically how it fits into Win32OLE, I’d really appreciate it - what  
I’d really like to have is a “canonical” list of all methods for each  
available Office module. But I haven’t found anything close to that  
yet.

James

---

<div class="post-metadata">

**Author:** ![chrisfinne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f1d935/32.png) [@chrisfinne](https://www.ruby-forum.com/u/chrisfinne)\
**Post date:** [September 7, 2006, 8:33pm UTC](https://www.ruby-forum.com/t/what-can-you-automate-with-ruby/67889/6 "2006-09-07T20:33:46Z")

</div>

Chris F. wrote:

> > If an automation facility exists
> 
> Is there a standard way to find out if an application enables  
> automation? or can you suggest a way?
> 
> > if the  
> > facility is reasonably flexible
> 
> Could you expand upon this please?

Okay, a decent, flexible automation facility will allow calls using  
plain-text arguments. Some proprietary automation facilities require  
rather  
baroque instructions, and a lot of very specific coding (like C-style  
structures). My remark appplies to the former case.

What I am saying is Ruby code is at best platform-independent, so it  
shouldn’t require a native-code section in order to accomplish its  
goals.
