How to Simulate keyboard key inputs?
120 views (last 30 days)
I am interested in simulating a keyboard input using .m code.
How would I go about simulating typing and other keyboard inputs?
Similar to this, but with the keyboard instead of the mouse.
More Answers (5)
ali on 30 Nov 2011
regarding"execute my code and Matt code on the command line of matlab (not in a script) :)"
I am going to kill an running script through simulating Ctrl+C which is written as a function like this:
import java.awt.Robot; import java.awt.event.*; SimKey=Robot; SimKey.keyPress(java.awt.event.KeyEvent.VK_CONTROL); SimKey.keyPress(java.awt.event.KeyEvent.VK_C); SimKey.keyRelease(java.awt.event.KeyEvent.VK_CONTROL);
how can I call it? when I call this function it does not work? Thanks, Ali
Amirhosein Ghenaati on 5 Dec 2014
hello i want to execute kmplayer then first launch kmplayer then use java robot to push space it will open media folder. my program stop when kmp starts and and when i terminates kmp space chracter will be printed in editor. here is my simple program and i dont know whats problem please help me in this situation
keys = Robot;
[status currdir] = system('cd C:\Users\IranZamin\Documents\MATLAB\temporary');
[status result] = system('KMPlayer.lnk');
Amirhosein Ghenaati on 19 Dec 2014
i tried to make exe version of key pressing with robot class but my exe file doesn't work and i dont know what i couldnt find relative .jar file for java robot class whats its name ?