awtrobot

Is it possible to click on Windows UAC dialog using java.awt.Robot?

五迷三道 提交于 2020-01-01 17:26:54
问题 I'm working on a custom remote desktop in Java using java.awt.Robot on Windows 7. It all works apart from running a Command Prompt as an administrator. The UAC dialog appears, however button clicks are not accepted on the Yes button using mousePress() / mouseRelease() , neither are key presses with keyPress() / keyRelease() . The application is launched via a launch4j launcher in launcher rather than wrap mode. Things I've done so far Disabled secure desktop for UAC. This allowed the screen

Switching Apps on Mac with AWT Robot only sometimes works

匆匆过客 提交于 2019-12-31 04:22:28
问题 I'm trying to use Robot in order to switch apps, and then enter some text. To do this (on my mac), I'm pressing Meta, Tab, and then releasing Tab, Meta in this order: Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_META); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_META); This works, but only occasionally (about every 5 or six presses). I've tried calling Thread.wait() inbetween press and release, but this has no effect. Neither does

Java Robot class press Turkish letter (Ö, ö, Ş, ş, Ü, ü, Ğ, ğ, İ, ı, Ç, ç, Ə, ə)?

纵然是瞬间 提交于 2019-12-30 09:49:33
问题 I have problem with press a special letter (Turkish etc.) via java robot class. I hava a method to press keys which works as alt+keycode. I cant convert some special letters to current keycode. So how can I solve it. Thanx For Example: KeyStroke ks = KeyStroke.getKeyStroke('ö', 0); System.out.println(ks.getKeyCode()); Output : 246 // So alt+0246='ö' //but if I convert 'ş' to keycode //Output is 351 . So alt+351= '_' and alt+0351= '_' //What is the Correct combination for 'ş'. same for 'Ş', 'ş

Cannot press Window+L using robot in Java

独自空忆成欢 提交于 2019-12-29 01:35:09
问题 I am using the Robot class to simulate key press in Java. But i am unable to press Window key+L although i am able to press them individually. Here is my code: private void pressKey() { Robot r=new Robot(); robot.keyPress(KeyEvent.VK_WINDOWS); robot.keyPress(KeyEvent.VK_L); robot.keyRelease(KeyEvent.VK_WINDOWS); robot.keyRelease(KeyEvent.VK_L); } 回答1: Try this instead: Runtime.getRuntime().exec("rundll32 user32.dll,LockWorkStation"); 回答2: Try: private void pressKey(){ Robot r=new Robot();

Prevent system tray icon from stealing focus when clicked

﹥>﹥吖頭↗ 提交于 2019-12-24 12:12:37
问题 I am writing an application in Java that places an icon in the system tray (via SWT). When this icon is clicked, I wish to have it automatically type some keys (via the Robot class) into whatever text field is in focus at the time of clicking (could be in any window). Unfortunately, clicking the system tray icon steals the focus away from the previously focused window, thereby stealing the key strokes. Is there a way to cause the text to be typed into the previously focused window? 回答1:

Robot class like classes for android [duplicate]

一笑奈何 提交于 2019-12-23 19:45:40
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Android API like java.awt.Robot Are there any other classes for android like Robot class in java, OR can we use Robot class in android ? 回答1: No, but an equivalent for you could be Instrumentation on Android. For instance with sendKeyDownUpSync(int key) for sending an up and down key event sync to the currently focused window. Instrumentation inst = new Instrumentation(); inst.sendKeyDownUpSync(KeyEvent.KEYCODE

How to simulate Keyboard press in java

耗尽温柔 提交于 2019-12-23 10:06:08
问题 I want to simulate entering a string (can contain any character) in JTextField. I am using new KeyEventData() for that. But I am not able to determine how to handle characters like {, }, ) etc and also how to append a new character to already entered characters. 回答1: You can use Robot for this, as shown in this example. To get { , for example, you'll need to do something like this: keyPress(KeyEvent.VK_SHIFT); keyPress(KeyEvent.VK_OPEN_BRACKET); keyRelease(KeyEvent.VK_OPEN_BRACKET);

Testing keyboard input with java.awt.Robot

痞子三分冷 提交于 2019-12-22 18:10:17
问题 I have a test that exercises a custom Swing component using java.awt.Robot. I'd like to run the test in our build server, but the build servers run on locked windows machines, and Robot.keyPress(char) doesn't work with the screen locked. The keystrokes I'm sending are sometimes things like down arrow and backspace, so sending them directly to the document isn't helpful. Currently I'm just using junit's Assume to skip the tests if keyboard entry doesn't work on the first try, but I'd like to

Java app makes screen display unresponsive after 10 minutes of user idle time

匆匆过客 提交于 2019-12-21 16:59:03
问题 I've written a Java app that allows users to script mouse/keyboard input (JMacro, link not important, only for the curious). I personally use the application to automate character actions in an online game overnight while I sleep. Unfortunately, I keep coming back to the computer in the morning to find it unresponsive. Upon further testing, I'm finding that my application causes the computer to become unresponsive after about 10 minutes of user idle time (even if the application itself it

Java Robot Class - Add focus to a specific running Application?

旧巷老猫 提交于 2019-12-21 06:23:07
问题 I am just trying to figure out if/how to get the Java Robot class to change focus from the running java app, to a specific process, such as ms word or firefox. Thanks! 回答1: Robot can't do that automatically. You can activate another application via alt-tab as has been suggested above, but you'll need to know the z-order of the application that you want to activate. I think that to really do this best you'll want to get the window's handle (hWnd) of the top-level window that you want to