← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #246667]: how to switch between remote desktop and local machine.(for ex.copy the content from local machine excel to remote desktop excel for some iterations).

 

Question #246667 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/246667

hariprasadh posted a new comment:
this is sikuli question.please find below the code which is used to take remote login by copying the  xl file to remote.
		s=new Screen();
		s.type("image");//if i type image in desktop,the image.xls gets selected
	    s.type("c",KeyModifier.CTRL);
		//to open the remote desktop
		App.open("C:\\Windows\\System32\\mstsc.exe");
		App myApp = new App("mstsc") ;
		s.wait(2.0);
			 
     	Toolkit toolkit = Toolkit.getDefaultToolkit();
     	Dimension screenSize = toolkit.getScreenSize();
     	Rectangle screenRect = new Rectangle(screenSize);
     	System.out.println(screenRect.getBounds());
     	Robot robot = new Robot();
     	BufferedImage image = robot.createScreenCapture(screenRect);
     	int height=image.getHeight();
     	int width=image.getWidth();
     	BufferedImage RemoteDesktopIcon=image.getSubimage(477, 130, 414, 250);
     	
     	BufferedImage TypeRDName_New1=image.getSubimage(559, 236, 243, 25);
     	boolean t=ImageIO.write(image, "png", new File("C:\\Users\\hari\\Desktop\\Images\\image.png"));
  	    ImageIO.write(RemoteDesktopIcon, "png", new File("C:\\Users\\hari\\Desktop\\Images\\RemoteDesktopIcon.png"));
  	    ImageIO.write(TypeRDName_New1, "png", new File("C:\\Users\\hari\\Desktop\\Images\\TypeRDName_New1.png"));	
		Region rdi=s.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\RemoteDesktopIcon.png"));
		Region rditype=s.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\TypeRDName_New1.png"));
		rdi.click(rditype);
	
		String pcname="PC144187";
		
		for(int i=0;i<=pcname.length();i++)
		{
			rdi.type(Key.BACKSPACE);
		}
		rdi.type(pcname);
		Region connect=rdi.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\Connect.png"));
		System.out.println(connect.getRect());
		rdi.click(connect);
		
		Region ws=s.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\WindowsSecurity.png"));
		ws.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\UserAccount.png"));
		ws.click(new Pattern("C:\\Users\\hari\\Desktop\\Images\\UserAccount.png"));
		
		ws.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\UserNameRMD.png"));
		ws.click(new Pattern("C:\\Users\\hari\\Desktop\\Images\\UserNameRMD.png"));
		ws.type("350734");
		
		ws.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\PasswordRMD.png"));
		ws.click(new Pattern("C:\\Users\\hari\\Desktop\\Images\\PasswordRMD.png"));
		ws.type("namasivaya89!");
		
		Region rokrmd=s.find(new Pattern("C:\\Users\\hari\\Desktop\\Images\\OKRMD1.png"));
		s.click(new Pattern("C:\\Users\\hari\\Desktop\\Images\\OKRMD1.png"));
		System.out.println("OKSize::::"+rokrmd.getRect());
		s.wait(8.0);
		s.type(Key.ENTER);
		
		//after that i need code  to paste the copied file  to remote desktop.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.