简体   繁体   English

如何使用eclipse中编写的Java代码在远程桌面中导航(例如,打开Mozilla)?

[英]How can i navigate (e.g. open Mozilla) in a Remote Desktop by using java code written in eclipse?

I want to be able to open Mozilla Firefox in a Remote Desktop and be able to "play" inside Mozilla (accessing URLs, import from the "Desktop" of the Remote Desktop Connection). 我希望能够在远程桌面中打开Mozilla Firefox,并能够在Mozilla中“播放”(访问URL,从远程桌面连接的“桌面”导入)。 All these, I want them to be automatically executed. 所有这些,我希望它们能够自动执行。 That is why I have created a java code in eclipse. 这就是为什么我在eclipse中创建了Java代码的原因。 So far, I am able to automatically access the Remote Desktop Connection. 到目前为止,我已经能够自动访问远程桌面连接。 Please find the code that I am using for this: 请找到我为此使用的代码:

public static void main(String[] args) throws IOException, InterruptedException {

    String ip = "xxx.xxx.xx.xx";    //check if this is the desired IP
    String userName = "XXX";        //check if this is the correct username
    String password = "XXXxxx";     //check if the password has changed
    String jacobDllVersionToUse;
    jacobDllVersionToUse = "jacob-1.18-x64.dll";

    File file = new File("lib", jacobDllVersionToUse);
    System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());

    // creating credentials
     Process p = Runtime.getRuntime().exec("cmdkey /generic:"+ip+" /user:"+userName+" /pass:"+password );
     p.destroy();    

     Process p2 = Runtime.getRuntime().exec("mstsc /v: "+ip+" /f /console");

     AutoItX x = new AutoItX();      
     x.winWaitActive("Remote Desktop Connection");
     x.controlClick("Remote Desktop Connection", "Co&nnect", "1");
     x.winWaitActive("Remote Desktop Connection");
     x.controlClick("Remote Desktop Connection", "Co&nnect", "1");
}

Could you assist me on how I will be able to open Mozilla in Remote Desktop through eclispse? 您能协助我如何通过eclispse在远程桌面中打开Mozilla吗?

Thank you in advance! 先感谢您!

I assume the code successfully activates the RDP Window. 我假设代码成功激活了RDP窗口。

Once it is active AutoIt can't identify elements controls inside the window, but you can still send keyboard commands using Java Robot or even AutoIt. 一旦激活,AutoIt将无法识别窗口中的元素控件,但是您仍然可以使用Java Robot甚至AutoIt发送键盘命令。

To launch Firefox send a Window+R and then pass the path of firefox.exe ("C:\\Program Files\\Mozilla Firefox\\firefox.exe") and send ENTER. 要启动Firefox,请发送Window + R,然后传递firefox.exe的路径(“ C:\\ Program Files \\ Mozilla Firefox \\ firefox.exe”)并发送ENTER。

暂无
暂无

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

相关问题 如何在Java中查看内置类的源代码(例如BigInteger等)? - How do I view source code of built-in classes in Java (e.g. BigInteger etc.)? Eclipse中的Java:如何在要使用getResource加载的文件系统上放置文件? (例如,ImageIcon的图像) - Java in Eclipse: Where do I put files on the filesystem that I want to load using getResource? (e.g. images for an ImageIcon) 在 Java 正则表达式中,如何获取字符类(例如 [az])以匹配 - 减号? - In a java regex, how can I get a character class e.g. [a-z] to match a - minus sign? 如何使用HtmlUnit检查我是否登录了网站(例如LinkedIn)? - How can I check if I logged in a website (e.g. LinkedIn) using HtmlUnit? 如何安装OAuth(例如apache oltu)以便在Eclipse for Java中使用API - How to install OAuth (e.g. apache oltu) in order to use an API with Eclipse for Java 在Azure中使用Java以任何方式打开自定义入站防火墙端口,例如8077 - Open custom inbound firewall ports e.g. 8077 by any way using java in azure IntelliJ是否可以隐藏Java样板代码,例如getter和setter - Can IntelliJ hide Java boilerplate code, e.g. getters and setters 如何使用Java中的Web服务(例如Axis2)发送复杂对象的数组或集合? - How do I send an array or collection of complex objects using web services in Java (e.g. Axis2)? Java中的程序代码修改(例如,变量提取) - Programatic code modification (e.g. variable extraction) in Java 使用Spring Security,我如何使用HTTP方法(例如GET,PUT,POST)来确定特定URL模式的安全性? - Using Spring Security, how can I use HTTP methods (e.g. GET, PUT, POST) to distingush security for particular URL patterns?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM