← Back to team overview

sikuli-driver team mailing list archive

[Question #216769]: Cropping image using SIKULI java api

 

New question #216769 on Sikuli:
https://answers.launchpad.net/sikuli/+question/216769

I am using sikuli script.jar for croping the image it is working fine but while migrate this code to sikuli java api croping is not working please check below mentioned two sets of code for reference and please suggest me how to proceed......

Sikuli Scripr.jar code
------------------------------
ss.click("images/crop.png");
ss.mouseDown(Button.LEFT);
ss.mouseMove("images/Arrow.png");
ss.mouseUp();

Sikuli Java Api code
-----------------------------
String path = "images/crop.png";
File f = new File(path);
URL url = f.toURI().toURL();

Target imageTarget = new ImageTarget(url);  
ScreenRegion r = sr.find(imageTarget);   
mouse.click(r.getCenter());
						
String paths = "images/eee.png";
File ff = new File(paths);
URL urll = ff.toURI().toURL();
Target imageTargets = new ImageTarget(urll);  
ScreenRegion rr = sr.find(imageTargets);   				        

ScreenLocation t1 = Relative.to(rr).center().getScreenLocation();				       	       
						
mouse.mouseDown(1);
						
mouse.drag(t1);		        

mouse.mouseUp();


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