Possibility using win32ole?

Discussion in 'Ruby' started by gregarican, Jul 8, 2005.

  1. gregarican

    gregarican Guest

    I have an old DOS app used for retail polling that I have to babysit.
    The app runs as a VDM window within a Windows 2000 Server session. That
    particular DOS window (when it has the focus) needs to receive a simple
    keystroke such as <Enter>. There are other windows which could be
    present, but when it has the focus this particular DOS window should
    get the keystroke. If another window receives the keystroke it could
    cancel the polling process.

    What I am wondering is if it is possible to write a Ruby script that I
    could schedule to submit a keystroke to that particular DOS VDM window
    based on its window name. Is this something that can be done? I am
    starting to revisit the Ruby API docs now. But if there isn't a method
    I can create or an existing method I can invoke to do this I might look
    elsewhere...
     
    gregarican, Jul 8, 2005
    #1
    1. Advertising

  2. gregarican

    gregarican Guest

    gregarican wrote:

    > I have an old DOS app used for retail polling that I have to babysit.
    > The app runs as a VDM window within a Windows 2000 Server session. That
    > particular DOS window (when it has the focus) needs to receive a simple
    > keystroke such as <Enter>. There are other windows which could be
    > present, but when it has the focus this particular DOS window should
    > get the keystroke. If another window receives the keystroke it could
    > cancel the polling process.
    >
    >
    > What I am wondering is if it is possible to write a Ruby script that I
    > could schedule to submit a keystroke to that particular DOS VDM window
    > based on its window name. Is this something that can be done? I am
    > starting to revisit the Ruby API docs now. But if there isn't a method
    > I can create or an existing method I can invoke to do this I might look
    > elsewhere...


    Actually I wouldn't be using win32ole to initialize these windows so I
    couldn't simply use the SendKeys win32ole method after create a new
    win32ole object. These are existing windows launched from a third party
    non-Ruby application. Thinking about it I suppose I should be looking
    at the win32api documentation to iterate through the open windows. From
    there sending a keystroke to a particular window would be the course of
    action. This would be the right track, correct?
     
    gregarican, Jul 8, 2005
    #2
    1. Advertising

  3. --0-1315128340-1120835362=:38380
    Content-Type: text/plain; charset=iso-8859-1
    Content-Transfer-Encoding: quoted-printable

    I think you should use AutoItX ( http://www.autoitscript.com/AutoIt/down=
    loads.php ). =20
    It can wait until a window gets the focus and also can send a keystroke t=
    o it. It has a COM interface, so it is easy to use it from Ruby.


    gregarican <> escribi=F3:
    gregarican wrote:

    > I have an old DOS app used for retail polling that I have to babysit.
    > The app runs as a VDM window within a Windows 2000 Server session. That
    > particular DOS window (when it has the focus) needs to receive a simple
    > keystroke such as . There are other windows which could be
    > present, but when it has the focus this particular DOS window should
    > get the keystroke. If another window receives the keystroke it could
    > cancel the polling process.
    >
    >
    > What I am wondering is if it is possible to write a Ruby script that I
    > could schedule to submit a keystroke to that particular DOS VDM window
    > based on its window name. Is this something that can be done? I am
    > starting to revisit the Ruby API docs now. But if there isn't a method
    > I can create or an existing method I can invoke to do this I might look
    > elsewhere...


    Actually I wouldn't be using win32ole to initialize these windows so I
    couldn't simply use the SendKeys win32ole method after create a new
    win32ole object. These are existing windows launched from a third party
    non-Ruby application. Thinking about it I suppose I should be looking
    at the win32api documentation to iterate through the open windows. From
    there sending a keystroke to a particular window would be the course of
    action. This would be the right track, correct?



    __________________________________________________
    Correo Yahoo!
    Espacio para todos tus mensajes, antivirus y antispam =A1gratis!=20
    Reg=EDstrate ya - http://correo.espanol.yahoo.com/=20
    --0-1315128340-1120835362=:38380--
     
    Lorenzo Jorquera, Jul 8, 2005
    #3
  4. gregarican

    gregarican Guest

    Lorenzo Jorquera wrote:

    > I think you should use AutoItX ( http://www.autoitscript.com/AutoIt/downloads.php ).
    > It can wait until a window gets the focus and also can send a keystroke to it. It has a > COM interface, so it is easy to use it from Ruby.


    Awesome. I figured there probably was some Windows utility that could
    perform this easier than reinventing the wheel myself. Appreciate the
    tip. Thanks!
     
    gregarican, Jul 8, 2005
    #4
  5. gregarican

    James Britt Guest

    Lorenzo Jorquera wrote:
    > I think you should use AutoItX (
    > http://www.autoitscript.com/AutoIt/downloads.php ).
    > It can wait until a window gets the focus and also can send a
    > keystroke to it. It has a COM interface, so it is easy to use it from
    > Ruby.


    Quite true. I script AutoIt with Ruby for a few things. It would be
    good option here.


    James
     
    James Britt, Jul 8, 2005
    #5
  6. gregarican

    gregarican Guest

    James Britt wrote:

    > Quite true. I script AutoIt with Ruby for a few things. It would be
    > good option here.
    >
    >
    > James


    I have already whipped up the AutoIt script and am so thankful that I
    was pointed in this direction. This utility has saved me the agony of
    remoting in to coax this old DOS app along its way. Great stuff. I can
    see employing this utility for lots of other things as well. My laptop
    should soon be soundly tucked away while I am getting extra sleep at
    night :)
     
    gregarican, Jul 8, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allan Herriman
    Replies:
    4
    Views:
    773
    Allan Herriman
    Aug 29, 2003
  2. Replies:
    3
    Views:
    916
  3. dmitrey
    Replies:
    17
    Views:
    339
    Carl Banks
    Jan 7, 2011
  4. Masaki Suketa
    Replies:
    4
    Views:
    419
    Dave Burt
    Mar 27, 2006
  5. zxem
    Replies:
    1
    Views:
    268
Loading...

Share This Page