Forum: Ruby windows application automation

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.
B5ba8b404e8481b77d474e195ab50d87?d=identicon&s=25 Wolfgang (Guest)
on 2006-04-07 20:53
(Received via mailing list)
Hi all,

I wan't to automate some applications which are running on mswin. Is it
somehow possible to "send" key prints to that application? For example
like "control s" for save.

Any suggestions?

Wolfgang
7e6ee7bc26cac7c3f1edce27558ced3d?d=identicon&s=25 Keith Sader (ksader)
on 2006-04-07 21:00
(Received via mailing list)
require 'win32ole' and read up on your favorite OLE browser.

What I've found is that I wind up fighting the (lack of) Ole
documentation as much as anything.

Here's a simple Ruby script I've written to check a mail store via
Mapi for #of new messages and attachments:

require 'win32ole'

mapiSession = WIN32OLE::new('Mapi.Session')
logonParam = "server" + "\n" + "account"
mapiSession.Logon('ProfileInfo' => logonParam)

new_messages = 0
total_messages = 0

mapiSession.Inbox.Messages.each {
    |message|
    begin
        new_messages += 1 if(message['UnRead'])
        total_messages += 1
        puts message['Sender'].Address
        puts message['Subject']
        puts 'Number of Attachments: ' +
message['Attachments'].count.to_s
    end
}

 puts "You have #{new_messages} new message(s)"
 puts "You have #{total_messages} total message(s)"

 mapiSession.Logoff

Was there a particular application(Outlook, Excel, etc?) that you were
hoping to automate?
B5ba8b404e8481b77d474e195ab50d87?d=identicon&s=25 Wolfgang (Guest)
on 2006-04-07 21:15
(Received via mailing list)
Hello Keith,

I have absolutely no information about OLE object that software uses. It
is a software for a microtomograph and I need to save images every
minute or so. All I would need is to send keyboard shortcuts to do the
task.

Wolfgang

Keith Sader schrieb:
B37a3acd4d6f90f33f042b88ae064d55?d=identicon&s=25 Cristi BALAN (Guest)
on 2006-04-07 22:00
(Received via mailing list)
On 4/7/06, Wolfgang <wollez@gmx.net> wrote:
> Hello Keith,
>
> I have absolutely no information about OLE object that software uses. It
> is a software for a microtomograph and I need to save images every
> minute or so. All I would need is to send keyboard shortcuts to do the task.
>
> Wolfgang
>

You can use the AutoItX com control to automate windows apps.
http://www.autoitscript.com/autoit3/

Try searching the list for autoit, there have been recent posts about
it and some have code samples.
B5ba8b404e8481b77d474e195ab50d87?d=identicon&s=25 Wolfgang (Guest)
on 2006-04-07 22:13
(Received via mailing list)
Hello Cristi,

that looks really good! Thanks a lot!
Wolfgang

Cristi BALAN schrieb:
This topic is locked and can not be replied to.