[英]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.