Mouse click with win32api

Discussion in 'Ruby' started by Emil Sandin, Mar 14, 2007.

  1. Emil Sandin

    Emil Sandin Guest

    Hi,
    I would like to write a script like this:

    mouse.move_cursor_to( x, y )
    mouse.click_left_button()

    I have read that I can use AutoIt, but that the program has to have an
    ole interface for it to be possible. That autoit doesn't really move the
    mouse cursor, but rather tells the program to click a certain
    coordinate.

    Is it possible to do this using win32api instead of autoIt, or is there
    another neat way of acheive it?

    Regards
    Emil

    --
    Posted via http://www.ruby-forum.com/.
    Emil Sandin, Mar 14, 2007
    #1
    1. Advertising

  2. Emil Sandin

    Emil Sandin Guest

    Emil Sandin wrote:
    > Hi,
    > I would like to write a script like this:
    >
    > mouse.move_cursor_to( x, y )
    > mouse.click_left_button()
    >
    > I have read that I can use AutoIt, but that the program has to have an
    > ole interface for it to be possible. That autoit doesn't really move the
    > mouse cursor, but rather tells the program to click a certain
    > coordinate.
    >
    > Is it possible to do this using win32api instead of autoIt, or is there
    > another neat way of acheive it?
    >
    > Regards
    > Emil


    Sorry, I was to fast to create a post.
    AutoIt seems to do the trick for me:

    gem install watir
    regsvr32 C:\ruby\lib\ruby\gems\1.8\gems\watir-1.4.1\watir\AutoItX3.dll
    irb
    require 'rubygems'
    require 'win32ole'
    a = WIN32OLE.new("AutoItX3.Control")
    a.mousemove(100, 100)
    a.mouseclick

    --
    Posted via http://www.ruby-forum.com/.
    Emil Sandin, Mar 14, 2007
    #2
    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. Davisro
    Replies:
    2
    Views:
    1,285
    Jim Corey
    Apr 23, 2004
  2. Max
    Replies:
    7
    Views:
    9,076
  3. =?Utf-8?B?am9qb2Jhcg==?=
    Replies:
    1
    Views:
    4,066
    wwwtar
    Oct 2, 2006
  4. Kid Kid
    Replies:
    6
    Views:
    458
  5. Daniish
    Replies:
    2
    Views:
    228
    Thomas 'PointedEars' Lahn
    Jun 13, 2008
Loading...

Share This Page