Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Mouse click with win32api

Reply
Thread Tools

Mouse click with win32api

 
 
Emil Sandin
Guest
Posts: n/a
 
      03-14-2007
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/.

 
Reply With Quote
 
 
 
 
Emil Sandin
Guest
Posts: n/a
 
      03-14-2007
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
This code requires the user 2 click the mouse twice, how do i do itin just one mouse-click? Daniish Javascript 2 06-13-2008 08:41 PM
How to simulate Mouse Click with Ruby, or mouse library Kid Kid Ruby 6 05-08-2007 12:43 PM
Menu Control - Expand items on mouse click rather than mouse hover =?Utf-8?B?am9qb2Jhcg==?= ASP .Net 1 10-02-2006 03:41 AM
Heres a mouse theres a mouse what a mouse do? unholy Gaming 37 09-17-2006 08:59 AM
ASP.Net Datagrid get Cell Contents on mouse click or mouse down Davisro ASP .Net 2 04-23-2004 07:18 PM



Advertisments