Sikuli Script integration with Java in Eclipse
hello sir i have plenty of problem to integrate sikuli with java can u explain me step by step
regard
anurag sharma
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Related bugs
Related FAQ:
None Link to a FAQ
This question was reopened
- by Anurag sharma
- by Anurag sharma
Revision history for this message
|
#1 |
It is simply as with every other Java package, whose API you want to use in Java code developed in Eclipse:
make sure, that sikuli-script.jar is in the class path.
The only additional aspect (supposing Windows):
path-to-Sikuli\libs and path-to-
The docs have additional hints.
Revision history for this message
|
#2 |
im new in java and sikuli so pls help me step by steps
Revision history for this message
|
#3 |
i follow all the step that mention in the doc but program is not working i use sikuli 0.9.
can anyone help me???
Revision history for this message
|
#4 |
Uuups, 0.9 is not supported any more.
You should upgrade to X-1.0rc3: better performance, more features.
Always uninstall a Sikuli version and reboot, before installing a newer version.
Make sure, the system path only contains pointers to the new version.
What is your environment? (system, Eclipse, Java, other relevant used stuff)
Revision history for this message
|
#5 |
hello sir
i did installed sikuli x-1.0rc3 and i try to run my program and the error in the console of eclipse is " Paste stack traces into this console and follow hyperlinks to source code."
i use eclipse 3.6.
how can i solve this problem
Revision history for this message
|
#6 |
--- What system + version? (Win, Mac, Linux?)
--- At least paste the error text you are getting (not the whole stack trace).
--- you say: im new in java and sikuli
hope that means new to Sikuli only!
pls. confirm: you should be familiar with Java programming in Eclipse.
Revision history for this message
|
#7 |
win xp
n my program tht i write
import edu.mit.
public class helloworld {
public static void main(String[] args) {
}
}
}
i add jar files "sikuli.script.jar" and corently im working on sikuli x-1.orc3
Revision history for this message
|
#8 |
i have done java programing for selenium rc so i m familiar but dont have a waste knowledge of java and i.ll try to find and click operation of start button but it doesnt work
plss provide me some guidlines with the help of tht i tackle my problem ..
Revision history for this message
|
#9 |
ok, when trying to get used to a new software, it is always a good idea to visit the docs.
on java programming:
http://
Revision history for this message
|
#10 |
BTW: since a click already makes a find():
}
... and if you do not really want to deal with FindFailed exceptions, tell Java your main throws FindFailed and get rid of the try/catch stuff - makes code really more readable and you do not loose anything.
get familiar with the exists() function.
Another tip: http://
Revision history for this message
|
#11 |
Hello Sir..
I have add the sikuli jar file in the class path of system variable C:\Program Files\Sikuli X
and after that i add path to sikuli\libs i.e. C:\Program Files\Sikuli X\libs in the path of system variable
and path to java\jre6\bin i.e. C:\Program Files\Java\jre6\bin in the path of system variable
and in the command line i write:- java -jar "C:\Program Files\Sikuli X\sikuli-
but it doesnt run in the command prompt..
and i write a program in java but i also show some error
package defaultt;
import edu.mit.
public class anu {
public static void main(String[] args) throws FindFailed {
s.wait(
s.find(
s.click(
}
}
now can u help me to tackle this problem...
if i made any mistake in command prompt, adding jar file and java file in system variable and in writting java program then plss guide me
Revision history for this message
|
#12 |
Hello Sir..
I have add the sikuli jar file in the class path of system variable C:\Program Files\Sikuli X
and after that i add path to sikuli\libs i.e. C:\Program Files\Sikuli X\libs in the path of system variable
and path to java\jre6\bin i.e. C:\Program Files\Java\jre6\bin in the path of system variable
and in the command line i write:- java -jar "C:\Program Files\Sikuli X
\sikuli-script.jar" imgs2.sikuli // imgs2.sikuli is the name of the
folder where i capture screen shot of the start button//
but it doesnt run in the command prompt..
and i write a program in java but i also show some error
package defaultt;
import edu.mit.
public class anu {
public static void main(String[] args) throws FindFailed {
}
}
now can u help me to tackle this problem...
if i made any mistake in command prompt, adding jar file and java file in system variable and in writting java program then plss guide m
Revision history for this message
|
#13 |
--- System Path
- no need to put sikuli-script.jar in the system class path, as long as you are running your java code from inside eclipse
you say: in the path of system variable
hope it is in system preferences the pane Systemproperties -> extended (or so) -> Environment Variables
There you should use the User Variables PATH entry and it should look like this:
any-stuff-
make sure, that in the entries "any-stuff-
(no need to touch the System Variables Path entry for that)
After editing this it might be a good idea to at least logout and login again.
--- java -jar "C:\Program Files\Sikuli X\sikuli-
no ned to do that, to run a .sikuli.
use Sikuli-IDE.bat -r imgs2.sikuli
This command is only of use in situations, where you do not have the complete Sikuli installation or for test situations, where one doubts, it has something to do with the IDE part.
--- java code
If we are still talking about Eclipse:
add sikuli-script.jar to the class path settings of your java project.
The docs at
http://
should have told you, that with X-1.0 it is no longer: import edu.mit.
but:
import org.sikuli.script.*
your image references are:
imgs2/start.png
but as far as I understand:
you captured your images in imgs2.sikuli (which is the folder, where the images reside).
So if you want to use the images in your java code:
imgs2.sikuli/
Have a look at class ImageLocator. This contains the method addImagePath(). When adding your image locations this way, you do not have the need to specify a path with each image, just the filename.
Revision history for this message
|
#14 |
Hello Sir..
Now i found new problem (related to Sikuli) currently my main machine is Linux and I am working on VM-win machine
(Windows XP) and my VM machine (Window-XP) is correpted so i again setup VM-win but in that new VM-win machine (Window-XP) I again installed Sikuli X 1.0rc3 but it doesnt capture the image it just open and when i click on "take a screenshot" then it doesnt capture image even it's not exists again..
So Sir pls now guide me whech steps i follow to tackle this problem
and im working on integrate Sikuli-IDE with eclipse so how can i done this bcs sikuli 0.9.8 doesnt support eclipse..
plss guide me
Revision history for this message
|
#15 |
Installed latest Java in standard place?
Try to use Sikuli-IDE.bat to start the IDE.
Revision history for this message
|
#16 |
Hello Sir
I installed latest version of java but now im working to capture image from Sikuli IDE X 1.0 rc3 but it does not work it just open and when i click on "take a screenshot" menu option then it does not capture any image.
the screen is not going to black that happens in Sikuli 0.10 or 0.9.
so how can i tackle this problem
n before 2-3 days back it work on Sikuli X 1.0rc3 at that time it works fine and after that my Virtual machine is corrupted then i setup new VM so in that Vertual machine i installed Sikuli X 1.0rc3 but it just open and doesnt capture any image..
plss guide me sir ...
Revision history for this message
|
#17 |
Hello Sir
I installed latest version of java but now im working to capture image from Sikuli IDE X 1.0 rc3 but it does not work it just open and when i click on "take a screenshot" menu option then it does not capture any image.
the screen is not going to black that happens in Sikuli 0.10 or 0.9.
so how can i tackle this problem
n before 2-3 days back it work on Sikuli X 1.0rc3 at that time it works fine and after that my Virtual machine is corrupted then i setup new VM so in that Vertual machine i installed Sikuli X 1.0rc3 but it just open and doesnt capture any image..
plss guide me sir ...
Revision history for this message
|
#18 |
-- Did you use Sikuli-IDE.bat to start the IDE?
If not, then try this first.
-- if this does not help, add -Dsikuli.
the modified line should look something like this from the beginning:
%JAVA_EXE% -Dsikuli.
Using this modified .bat should show the aborting error in the command line window.
Revision history for this message
|
#19 |
Yes Sir i use Sikuli-IDE.bat to start the IDE.
i,;; try to open the Sikuli-X-1.0rc3 .
Sikuli IDE new version have plenty of feature to automate application and lots of command available to use ..
sir can u give me a favour if i have any problem then can i discuss with u by Skype or through Mail ????
and i'll try to integrate Sikuli-IDE with eclipse but i face plenty of problems so can u provide me workspace or set up or any small project so with the help of that i try to tackle this ???
regard :-
Anurag Sharma
Revision history for this message
|
#20 |
Yes Sir i use Sikuli-IDE.bat to start the IDE.
i,;; try to open the Sikuli-X-1.0rc3 .
Sikuli IDE new version have plenty of feature to automate application and lots of command available to use ..
sir can u give me a favour if i have any problem then can i discuss with u by Skype or through Mail ????
and i'll try to integrate Sikuli-IDE with eclipse but i face plenty of problems so can u provide me workspace or set up or any small project so with the help of that i try to tackle this ???
regard :-
Anurag Sharma
Revision history for this message
|
#21 |
sir can u give me the doumentation of Sikuli X 1.0rc3 ..
Revision history for this message
|
#22 |
--- i'll try to integrate Sikuli-IDE with eclipse
that does not make any sense (it is not Sikuli-IDE that is integrated).
You might either use the PyDev plugin to develop and run Jython code, that uses the Sikuli Jython API (see: http://
Or you might develop in plain Java (or any other Java based language like Scala, Groovy, JRuby, ...) using Sikuli's Java level API (see: http://
In both cases only sikuli-script.jar is relevant (and the native libraries coming with Sikuli).
In fact, you need some tool to capture images. Sikuli-IDE might be used for that. But you can use any other available capture tool or even write your own with a few lines of Sikuli code and run it from command line.
--- Sikuli-IDE not working
I asked you to try:
add -Dsikuli.
the modified line should look something like this from the beginning:
%JAVA_EXE% -Dsikuli.
Using this modified .bat should show the aborting error in the command line window.
But I did not see any feedback
--- can u give me the doumentation of Sikuli X 1.0rc3
http://
--- if i have any problem then can i discuss with u by Skype or through Mail
Skype: no
Mail: yes
send your stuff including appropriate screenshots altogether in one zipped file to my mail at: https:/
Revision history for this message
|
#23 |
Yes Sir my Sikuli IDE X 1.0 rc3 is working fine ...
i capture script of http://
when i completed my script then i send u sir
Revision history for this message
|
#24 |
Hi SIr..
When i m giving input for email OR in the URL then previously use data is appear so how can i erase that with the use of sikuli-IDE
regard
Anurag sharma
Revision history for this message
|
#25 |
-- previously use data is appear so how can i erase
have a look at question https:/
and transpose the code to Java
Revision history for this message
|
#26 |
Hello SIr Good Morning ...
i want to select a item drop down menu but when i'll try this it doesnt capture
i.e. click(123.png" \\123.png is the drop down menu tht menu have some other option i.e. country menu drop down n i want select india, india is place in 4 position \\
find(456.png) \\ 456.png is the list when i click on drop down menu then list appear\\
click(789.png) \\ 789.png is the name of item that i want select\\
but when i click on tht it doesnt select the list was disappear before after tht it click
so how can i select a drop down menu???
Revision history for this message
|
#27 |
In situations like that, you have to use the capture hotkey:
- Have Sikuli IDE open with your script
- go to your app and prepare the situation to capture
- press capture hotkey - capture will now be possible
Revision history for this message
|
#28 |
Sir i'll try fro hotkey but it doesnt work..
my problem is like tht when i click on start button then drop down window will appear but when i'll try to click on the item those exists in that drop down list so it doesnt work...
how can i solve this problem and plss give me a some example ??\
Revision history for this message
|
#29 |
I tested on my Win7 and have to admit, that I had problems.
Historically the hotkey was shift-ctrl 2, but that did not work anymore. Trying to add it again did not succeed: shift-ctrl 2 is blocked somehow.
Adding another combination like e.g. shift-ctrl 1 finally worked.
The capturing method still is:
- Have Sikuli IDE open with your script
- go to your app and prepare the situation to capture
- press capture hotkey - capture will now be possible and you will have the image in your script
But be aware, that Preview might not be possible with images captured that way.
Revision history for this message
|
#30 |
Sir i use hotkey Ctrl+Shift+1 for capture image but it does not work it doesnt black the screen..
i use Ctrl+Shift+2 it work and it capture the drop down menu but it doesnt take the selected item of that drop down menu..
hot key (Ctrl+Shift+1) doesnt capture the screenshot so how can i tackle this ???
Revision history for this message
|
#31 |
You have to register a new hot key like Ctrl+Shift+1 in Sikuli IDE's preferences before you can use it.
Can you help with this problem?
Provide an answer of your own, or ask Anurag sharma for more information if necessary.