Thread Subject: How to generate mouse clicks to the Operating System?

Subject: How to generate mouse clicks to the Operating System?

From: Shane Brennan

Date: 13 Sep, 2007 02:21:47

Message: 1 of 5

I am writing a program which tracks a laser light that is
shined onto a wall. The code is able to track the laser
fine, and I am able to recognize when the user "clicks" (by
turning the laser off and on real quick). However, I do not
know how to transmit this click information to the Operating
System.

What I am wondering is, is there a MATLAB function or some
other method I can use to generate a mouse click?

Subject: How to generate mouse clicks to the Operating System?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 13 Sep, 2007 02:39:04

Message: 2 of 5

In article <fca6rr$mld$1@fred.mathworks.com>,
Shane Brennan <LoopUniverse+SPAM@gmail.com> wrote:
>I am writing a program which tracks a laser light that is
>shined onto a wall. The code is able to track the laser
>fine, and I am able to recognize when the user "clicks" (by
>turning the laser off and on real quick). However, I do not
>know how to transmit this click information to the Operating
>System.

>What I am wondering is, is there a MATLAB function or some
>other method I can use to generate a mouse click?

There is no Matlab function for it. There might be an
ActiveX control (maybe), or dll function you could use.
If you are using Windows, this page might be useful:

http://msdn2.microsoft.com/en-us/library/ms171548.aspx

I found a different page that indicated that simulating a
right click might be relatively difficult:

http://www.daniweb.com/forums/thread10948.html

--
   Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson

Subject: How to generate mouse clicks to the Operating System?

From: Dan Haeg

Date: 13 Sep, 2007 05:10:33

Message: 3 of 5

"Shane Brennan" <LoopUniverse+SPAM@gmail.com> wrote in
message <fca6rr$mld$1@fred.mathworks.com>...
> I am writing a program which tracks a laser light that is
> shined onto a wall. The code is able to track the laser
> fine, and I am able to recognize when the user "clicks" (by
> turning the laser off and on real quick). However, I do not
> know how to transmit this click information to the Operating
> System.
>
> What I am wondering is, is there a MATLAB function or some
> other method I can use to generate a mouse click?


% create a robot
import java.awt.*;
import java.awt.event.*;
rob=Robot;
rob.mousePress(InputEvent.BUTTON1_MASK)%change button here
%may want a pause here
rob.mouseRelease(InputEvent.BUTTON1_MASK)%change button here

% to see more robot options
methodsview(rob);

I learned how to do this when I wanted to write a matlab
program to draw lines in linerider.

this site has more information about the robot
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html#mousePress(int)

Subject: How to generate mouse clicks to the Operating System?

From: us

Date: 13 Sep, 2007 07:01:54

Message: 4 of 5

Shane Brennan:
<SNIP to weak to press a button...

one of the solutions was outlined in this reply, which
shows how to simulate mouse moves/clicks...

http://groups.google.com/group/comp.soft-
sys.matlab/msg/4bc21a262ac3a74f?dmode=source

us

Subject: How to generate mouse clicks to the Operating System?

From: Aoys

Date: 18 Sep, 2007 13:39:48

Message: 5 of 5

Hello everbody, I have the same problem,

I build a GUI and added a Listbox to it, now I have to
click the right mouse button to choose some of the listbox
items...My question: is it possible to do this right click
of the mouse by writing a M-Code in matlab...and thanks in
advance..

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
mouse Aoys 18 Sep, 2007 09:40:29
right click Aoys 18 Sep, 2007 09:40:29
m Aoys 18 Sep, 2007 09:40:29
java Dan Haeg 13 Sep, 2007 01:15:08
robot Dan Haeg 13 Sep, 2007 01:15:08
operating system Shane Brennan 12 Sep, 2007 22:25:09
mouse Shane Brennan 12 Sep, 2007 22:25:09
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com