# New to Ruby : Can anyone help

**URL:** <https://www.ruby-forum.com/t/new-to-ruby-can-anyone-help/87500>\
**Category:** Ruby\
**Created:** [March 3, 2007, 1:36am UTC](https://www.ruby-forum.com/t/new-to-ruby-can-anyone-help/87500 "2007-03-03T01:36:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Studentfj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Studentfj](https://www.ruby-forum.com/u/Studentfj)\
**Post date:** [March 3, 2007, 1:36am UTC](https://www.ruby-forum.com/t/new-to-ruby-can-anyone-help/87500/1 "2007-03-03T01:36:56Z")

</div>

Hi  
I am new to Ruby.  
What I want to do is to start up an appliacation (GUI  
of course) and use Ruby to move the mouse to the  
application Button called Start and click on it when  
it is active (ie not greyed out).  
I can start the application by putting a shortcut in  
the XP startup folder, and pass the file as input  
parameter but how to use Ruby to move the mouse to  
different buttons (three buttons in this app Start  
,Continue , Cancel ) in the application windows  
and click on it, and also how to test the button is  
active before I can click on it.

My normal steps are :-

1. double click on app.exe
2. move mouse to File \>\> open \>\> datafile.dat
3. move mouse to the START button ( which is active)  
in the application windows and double click the button

Basically I want to automate Step 1 ,2 and 3 above.

Can anyone help  
Many thanks  
Fred Johnsons

---

<div class="post-metadata">

**Author:** ![Studentfj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Studentfj](https://www.ruby-forum.com/u/Studentfj)\
**Post date:** [March 3, 2007, 2:10am UTC](https://www.ruby-forum.com/t/new-to-ruby-can-anyone-help/87500/2 "2007-03-03T02:10:59Z")

</div>

On 2 mar, 21:36, Studentfj [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. double click on app.exe
> 2. move mouse to File \>\> open \>\> datafile.dat
> 3. move mouse to the START button ( which is active)  
> in the application windows and double click the button
> 
> Basically I want to automate Step 1 ,2 and 3 above.

What you are asking really has little to do with ruby, but more about  
finding hooks in the windows API to do what you want (as it is a  
somewhat obscure thing to do, you’ll probably find few people that  
know how to).  
You should ask your question in a windows programming newsgroup and  
try searching microsoft’s knowledge base and forums for the answer.  
If you then want to code the solution in ruby, ruby offers things like  
the win32ole and similar modules to give you access to the proper API  
calls in windows, but you need to know what those are first.

---

<div class="post-metadata">

**Author:** ![Studentfj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Studentfj](https://www.ruby-forum.com/u/Studentfj)\
**Post date:** [March 3, 2007, 12:23pm UTC](https://www.ruby-forum.com/t/new-to-ruby-can-anyone-help/87500/3 "2007-03-03T12:23:33Z")

</div>

gga schrieb:

> somewhat obscure thing to do, you’ll probably find few people that  
> know how to).

You could also look at AutoIt ([AutoIt Scripting Language - AutoIt](http://www.autoitscript.com/autoit3)). I  
and other people on this mailing list have used it together with Ruby to  
automate Windows. You should be able to find some examples in the  
archives.

Regards,  
Pit
