[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Keyboard access

Harry

4/2/2006 8:39:00 AM

How can I gain access to the keyboard so that I can feed output from
my ruby program into an application that only accepts input via the
keyboard?

I want the application to think the input is coming from the keyboard
when it is really coming from a ruby program output.

Thanks for any help.


5 Answers

Harry

4/2/2006 8:51:00 AM

0

I am using Windows2000.

On 4/2/06, Harry <rubyprogrammer@gmail.com> wrote:
> How can I gain access to the keyboard so that I can feed output from
> my ruby program into an application that only accepts input via the
> keyboard?
>
> I want the application to think the input is coming from the keyboard
> when it is really coming from a ruby program output.
>
> Thanks for any help.
>
>


David Vallner

4/2/2006 3:01:00 PM

0

Dna Nedela 02 Apríl 2006 10:39 Harry napísal:
> How can I gain access to the keyboard so that I can feed output from
> my ruby program into an application that only accepts input via the
> keyboard?
>
> I want the application to think the input is coming from the keyboard
> when it is really coming from a ruby program output.
>
> Thanks for any help.

Is it a console or window application?

In the former case, a simple pipe should suffice, in the latter, you're
probably looking at using OLE to run the application from within Ruby and
fake keypresses using the Windows Scripting Host facilities.

David Vallner
Probably Wrong


james_b

4/2/2006 3:32:00 PM

0

Harry wrote:
> I am using Windows2000.

Go grab AutoItX, and script it from Ruby.

require 'win32ole'
app_window_title = "The App I Want To Type Into"
@au3 = WIN32OLE.new("AutoItX3.Control")
@au3.opt("WinTextMatchMode", 2)
@au3.Run( "C:\\Program Files\\SomeApp.exe" )
@au3.WinWaitActive( app_window_title )
@au3.Send( "Some text to type to the application" )


--
James Britt

http://web2.0val... - We're the Dot in Web 2.0
http://refreshing... - Design, technology, usability
http://yourelevato... - Finding Business Focus
http://www.jame... - Playing with Better Toys


Harry

4/3/2006 9:55:00 AM

0

I neglected to say that it is a windows application.
OLE was the answer.

Thanks for your help.

On 4/3/06, David Vallner <david@vallner.net> wrote:

> Is it a console or window application?
>
> In the former case, a simple pipe should suffice, in the latter, you're
> probably looking at using OLE to run the application from within Ruby and
> fake keypresses using the Windows Scripting Host facilities.
>
> David Vallner
> Probably Wrong
>
>


Harry

4/3/2006 9:59:00 AM

0

That was exactly what I was looking for.
I tried it out Monday morning and it worked.
Excellent!!

Thank you.

On 4/3/06, James Britt <james_b@neurogami.com> wrote:
>
> Go grab AutoItX, and script it from Ruby.
>
> require 'win32ole'
> app_window_title = "The App I Want To Type Into"
> @au3 = WIN32OLE.new("AutoItX3.Control")
> @au3.opt("WinTextMatchMode", 2)
> @au3.Run( "C:\\Program Files\\SomeApp.exe" )
> @au3.WinWaitActive( app_window_title )
> @au3.Send( "Some text to type to the application" )
>
>
> --
> James Britt
>
> http://web2.0val... - We're the Dot in Web 2.0
> http://refreshing... - Design, technology, usability
> http://yourelevato... - Finding Business Focus
> http://www.jame... - Playing with Better Toys
>
>