简体   繁体   English

复制粘贴不能使用机器人类:Ctrl + C; 内容没有保存到剪贴板中,但几天前它可以正常工作

[英]Copy paste not working using Robot Class: Ctrl+C; content is not saving into clipboard, but it used to work perfectly fine few days back

    *

Basically i've selected some text and trying to copy it; 基本上我已经选择了一些文本并尝试复制它; but below code is not doing Ctrl+C during runtime-nothing is storing into clipboard-however manually i've tried my keys are working fine, but it used to work few days back. 但是下面的代码在运行时没有执行Ctrl + C,什么都没有存储到剪贴板中,但是我手动尝试了我的键可以正常工作,但是几天以前就可以正常工作了。 Could you please help me on this issue. 您能帮我解决这个问题吗?

        robot.keyPress(KeyEvent.VK_CONTROL);
            Thread.sleep(2000);
                    robot.keyPress(KeyEvent.VK_C);
                    Thread.sleep(2000);
                    robot.keyRelease(KeyEvent.VK_CONTROL);
                    Thread.sleep(2000);
                    robot.keyRelease(KeyEvent.VK_C);

*

First you need to release the key "C" and then "Control" key. 首先,您需要释放键“ C”,然后释放“ Control”键。

robot.keyPress(KeyEvent.VK_CONTROL);
Thread.sleep(2000);
robot.keyPress(KeyEvent.VK_C);
Thread.sleep(2000);
robot.keyRelease(KeyEvent.VK_C);
Thread.sleep(2000);
robot.keyRelease(KeyEvent.VK_CONTROL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Shift +向右键不使用Robot Class选择文本,但是几天前它可以正常工作 - Shift + Right Arrow is not selecting text using Robot Class, but it used to work perfectly fine few days back Java机械手上的Ctrl + C不起作用 - Ctrl+C on Java robot is not working 为什么CTRL + C(用Awt.Robot模拟)不能正常工作? - Why doesn't CTRL+C (simulated with Awt.Robot) work properly? 如何在不使用剪贴板或操作 CTRL+C、CTRL+V 的情况下将字符串中的“\\t”或“tab”发送到 selenium 中的文本框 - How to send “\t” or “tab” within a string into textbox in selenium without using Clipboard or Actions CTRL+C, CTRL+V Java JMenu CTRL + C快捷键不起作用 - Java JMenu CTRL+C shortcut not working 复制Intellij中完整的类代码(Ctrl + A,Ctrl + C)时不要复制包名称 - Don't copy package name while copying complete a class code (Ctrl+A, Ctrl+C) code in Intellij 将剪贴板的所有权设置为StringSelection后,CTRL + C不会复制到剪贴板 - CTRL+C not copying to clipboard after I set ownership of clipboard to StringSelection 禁用Ctrl + C - Disabling Ctrl+C 如何模拟ctrl + c在bash中复制文件 - How to simulate ctrl+c to copy file in bash 使用Clipboard和AbstractAction进行JTable复制和粘贴 - JTable copy and paste using Clipboard and AbstractAction
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM