From: Bulent on
Hello,

I am using Matlab 7.8.0 2009a on Windows XP.

I wrote a simple code which moves the mouse pointer and then clicks. Here is the code:

import java.awt.Robot;
import java.awt.event.*;
mouse=Robot;
mouse.mouseMove(100,100);
mouse.mousePress(InputEvent.BUTTON1_MASK);

If I execute this code on Matlab, it works fine. But I want to create an exe file for the same purpose.

-mcc -m myfun

However, when the program runs, I get this error: "??? Undefined function or variable InputEvent" for line 5. mouseMove command is executed without problem but the line 5 produces an error. I examined the previous posts, tried to include the library files, or to change the path. But the I was unable to solve the problem.

Can anyone give me any ideas? I would appreciate.
Bulent
From: Steven Lord on

"Bulent " <bilowcan(a)yahoo.com> wrote in message
news:i0i5m0$la9$1(a)fred.mathworks.com...
> Hello,
>
> I am using Matlab 7.8.0 2009a on Windows XP.
>
> I wrote a simple code which moves the mouse pointer and then clicks. Here
> is the code:
> import java.awt.Robot;
> import java.awt.event.*;
> mouse=Robot;
> mouse.mouseMove(100,100);
> mouse.mousePress(InputEvent.BUTTON1_MASK);
>
> If I execute this code on Matlab, it works fine. But I want to create an
> exe file for the same purpose.
>
> -mcc -m myfun
>
> However, when the program runs, I get this error: "??? Undefined function
> or variable InputEvent" for line 5. mouseMove command is executed without
> problem but the line 5 produces an error. I examined the previous posts,
> tried to include the library files, or to change the path. But the I was
> unable to solve the problem.
>
> Can anyone give me any ideas? I would appreciate.

What happens if you use the full name of the event rather than IMPORTing
java.awt.event.*?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Yair Altman on
"Steven Lord" <slord(a)mathworks.com> wrote...
> What happens if you use the full name of the event rather than IMPORTing
> java.awt.event.*?


What Steve meant was to use java.awt.event.InputEvent.BUTTON1_MASK instead of just InputEvent. If this solves your problem, please report this to issuport(a)mathworks.com as a bug in the Matlab compiler.

Alternately, you can always use the numeric value for this constant (=16).

Yair Altman
http://UndocumentedMatlab.com
From: Bulent on
"Yair Altman" <altmanyDEL(a)gmailDEL.comDEL> wrote in message <i0if5o$jdl$1(a)fred.mathworks.com>...
> "Steven Lord" <slord(a)mathworks.com> wrote...
> > What happens if you use the full name of the event rather than IMPORTing
> > java.awt.event.*?
>
>
> What Steve meant was to use java.awt.event.InputEvent.BUTTON1_MASK instead of just InputEvent. If this solves your problem, please report this to issuport(a)mathworks.com as a bug in the Matlab compiler.
>
> Alternately, you can always use the numeric value for this constant (=16).
>
> Yair Altman
> http://UndocumentedMatlab.com

Thank you very much for your help (especially to Yair who helped me understand the idea of Steve). Both ideas work fine.