Prev: How to exclude hidden directories from path
Next: How to send data using sound wave as carrier.
From: andandgui isler on 12 Jun 2010 07:46 Walter Roberson <roberson(a)hushmail.com> wrote in message <l3EQn.76020$HG1.53286(a)newsfe21.iad>... > andandgui isler wrote: > > > now i have the problem with > > question mark > > and some special characters like Ö Ü > > > > how can i press them using MATLAB.. i write code of other keys but i > > cant find these keys code or any alternative method to press them. > > what should i do > > question mark is shift / and so follows similar rules to what I > described before with respect to ( . > > Ö Ü need modifier keys to enter. > > In terms of the java sequences Matt hinted at: > > http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html > > ( is VK_LEFT_PARENTHESIS > ) is VK_RIGHT_PARENTHESIS > Ö seems to be VK_DEAD_ABOVEDOT VK_O > Ü seems to be VK_DEAD_ABOVEDOT VK_U > > "Not all characters have a keycode associated with them. For example, > there is no keycode for the question mark because there is no keyboard > for which it appears on the primary layer." > > and that implies that question-mark is VK_SHIFT VK_SLASH > > And remember to generate the appropriate VK_KEYPRESSED and > VK_KEYRELEASED events (I guess... I don't know what would happen if you > just entered one of the VK_* without a VK_KEYPRESSED ) Thanks for your attention Walter Roberson. The problem still countinues. When i type the code below : import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; keyboard=Robot; >> keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); ??? keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); | Error: Unexpected MATLAB expression. gives this error and also >> keyboard.keyPress(KeyEvent.VK_SHIFT VK_SLASH) ??? keyboard.keyPress(KeyEvent.VK_SHIFT VK_SLASH) | Error: Unexpected MATLAB expression.
From: Walter Roberson on 12 Jun 2010 11:13 andandgui isler wrote: > import java.awt.AWTException; import java.awt.Robot; import > java.awt.event.KeyEvent; keyboard=Robot; >>> keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); > ??? keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); > | > Error: Unexpected MATLAB expression. keyboard.keyPress.KeyEvent.VK_DEAD_ABOVEDOT; keyboard.keyPress.KeyEvent.VK_O; The KeyEvent method takes only a single keycode.
From: us on 12 Jun 2010 11:37 Walter Roberson <roberson(a)hushmail.com> wrote in message <4uNQn.37429$rU6.27814(a)newsfe10.iad>... > andandgui isler wrote: > > > import java.awt.AWTException; import java.awt.Robot; import > > java.awt.event.KeyEvent; keyboard=Robot; > >>> keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); > > ??? keyboard.keyPress(KeyEvent.VK_DEAD_ABOVEDOT VK_O); > > | > > Error: Unexpected MATLAB expression. > > keyboard.keyPress.KeyEvent.VK_DEAD_ABOVEDOT; > keyboard.keyPress.KeyEvent.VK_O; > > The KeyEvent method takes only a single keycode. this is the wrong syntax, though... it should read import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; kbd=Robot; % <- don't use KEYBOARD as a var... kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT); % <- see below... kbd.keyPress(KeyEvent.VK_O); % <- this works... % however, this does NOT always work... kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT); %{ ??? Java exception occurred: java.lang.IllegalArgumentException: Invalid key code at sun.awt.windows.WRobotPeer.keyPress(Native Method) at java.awt.Robot.keyPress(Unknown Source) %} us
From: andandgui isler on 12 Jun 2010 22:15 Thanks for your attention Walter Roberson and us i'm using MATLAB R2009b but when i type given code below by yours, it still gives me error. import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; kbd=Robot; kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT); ??? Java exception occurred: java.lang.IllegalArgumentException: Invalid key code at sun.awt.windows.WRobotPeer.keyPress(Native Method) at java.awt.Robot.keyPress(Unknown Source) kbd.keyPress(KeyEvent.VK_O); >> o kbd.keyPress(KeyEvent.VK_O) works but, kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT) doen't work on my computer
From: us on 12 Jun 2010 22:41 "andandgui isler" <bosisler_ist(a)hotmail.com> wrote in message <hv1evp$dh8$1(a)fred.mathworks.com>... > Thanks for your attention Walter Roberson and us > i'm using MATLAB R2009b but when i type given code below by yours, it still gives me error. > > import java.awt.AWTException; > import java.awt.Robot; > import java.awt.event.KeyEvent; > kbd=Robot; > kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT); > ??? Java exception occurred: > java.lang.IllegalArgumentException: Invalid key code > > at sun.awt.windows.WRobotPeer.keyPress(Native Method) > > at java.awt.Robot.keyPress(Unknown Source) > > > kbd.keyPress(KeyEvent.VK_O); > >> o > > > kbd.keyPress(KeyEvent.VK_O) works but, > kbd.keyPress(KeyEvent.VK_DEAD_ABOVEDOT) doen't work on my computer well, yes... that's EXACTLY what i said in my reply: this solution does not work... us
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: How to exclude hidden directories from path Next: How to send data using sound wave as carrier. |