How to keep pressed the SHIFT button on the keyboard?
Hi all! I have two monitors and I need to pass the browser window form the left monitor to the right monitor. The shortcut to do this on the keyboard is: WINDOW + SHIFT + RIGHT ARROW. If i press phisically those 3 buttons on the keyboard the windows is correctly moved to the right monitor, however, if I try to do the same on MATLAB with this code:
import java.awt.*;
import java.awt.event.*;
rob=Robot;
[stat, h, url] = web(‘https://www.google.com’,’-new’);
pause(5)
rob.keyPress(KeyEvent.VK_WINDOWS);
rob.keyPress(KeyEvent.VK_SHIFT);
rob.keyPress(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_SHIFT);
rob.keyRelease(KeyEvent.VK_WINDOWS);
The output is like I press WINDOW + RIGHT ARROW. So, seems like the SHIFT button is pressed and released before the RIGHT ARROW button. Someone can help me? Many thanks!Hi all! I have two monitors and I need to pass the browser window form the left monitor to the right monitor. The shortcut to do this on the keyboard is: WINDOW + SHIFT + RIGHT ARROW. If i press phisically those 3 buttons on the keyboard the windows is correctly moved to the right monitor, however, if I try to do the same on MATLAB with this code:
import java.awt.*;
import java.awt.event.*;
rob=Robot;
[stat, h, url] = web(‘https://www.google.com’,’-new’);
pause(5)
rob.keyPress(KeyEvent.VK_WINDOWS);
rob.keyPress(KeyEvent.VK_SHIFT);
rob.keyPress(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_SHIFT);
rob.keyRelease(KeyEvent.VK_WINDOWS);
The output is like I press WINDOW + RIGHT ARROW. So, seems like the SHIFT button is pressed and released before the RIGHT ARROW button. Someone can help me? Many thanks! Hi all! I have two monitors and I need to pass the browser window form the left monitor to the right monitor. The shortcut to do this on the keyboard is: WINDOW + SHIFT + RIGHT ARROW. If i press phisically those 3 buttons on the keyboard the windows is correctly moved to the right monitor, however, if I try to do the same on MATLAB with this code:
import java.awt.*;
import java.awt.event.*;
rob=Robot;
[stat, h, url] = web(‘https://www.google.com’,’-new’);
pause(5)
rob.keyPress(KeyEvent.VK_WINDOWS);
rob.keyPress(KeyEvent.VK_SHIFT);
rob.keyPress(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_RIGHT);
rob.keyRelease(KeyEvent.VK_SHIFT);
rob.keyRelease(KeyEvent.VK_WINDOWS);
The output is like I press WINDOW + RIGHT ARROW. So, seems like the SHIFT button is pressed and released before the RIGHT ARROW button. Someone can help me? Many thanks! java, keypress MATLAB Answers — New Questions