MATLAB Answers

Where did I go wrong

1 view (last 30 days)
Hi all
pause(1.5)
import java.awt.Robot;
import java.awt.event.*;
key =Robot ;
handles.n=str2double(get(handles.edit1,'string')) ;
for i=1:handles.n;
key.keyPress (java.awt.event.KeyEvent.VK_Z);
pause(1)
end
once the keyboard is the Z Clicked. but the notebook is working properly. the program is not in the game.
please help me.
(I'm Working guide.)

Accepted Answer

Walter Roberson
Walter Roberson on 6 May 2011
Which notebook is working properly? What game is being referred to?
I notice that you have not send release events for the keys pressed.
  4 Comments
nsbd
nsbd on 6 May 2011
new
"pause(1.5)
import java.awt.Robot;
import java.awt.event.*;
key = Robot ;
n=str2double(get(handles.edit1,'string')) ;
for i=1:n;
key.keyPress(java.awt.event.KeyEvent.VK_5);
pause(1.5)
key.keyRelease(java.awt.event.KeyEvent.VK_5);
pause(1.5)
end
"
:) this trying thank you Roberson.
Eror = (handles.n) changed (n)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by