Is it possible to convert a .skl file to a .exe file?

Asked by Test

I have searched high and low for this answer but to no avail.

I understand that .skl file is an executable file and can be run via the command line. I can also create a batch file to execute this .skl file so that all I need to do is to run the batch file.

But this leads to the command prompt being opened, and then the sikuli script being run. What I want to achieve is that the end user can click on a .exe file, and it runs the .skl file, to keep it as simple as possible without opening any additional programs.

Is there any way for me to do this, or is the batch file as far as I can get?

If the batch file is as far as I can go, how do I do it?

I've tried this:

java -jar "C:\path-to-sikuli\sikuli-ide.jar" "C:\path-to-skl\script.skl"
java -jar "C:\path-to-sikuli\sikuli-ide.jar" -r "C:\path-to-skl\script.skl"

The first one simply opens up the IDE without running the script and the second one pops up with a prompt: http://i.imgur.com/7RotHec.png

When I click OK, the script runs, but I don't understand why the prompt appears in the first place since I already told it to run the .skl file.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
obiwan-92 (obiwan-92) said :
#1

Hello,

To launch a script in a batch file :
java -jar "C:\path-to-sikuli\sikuli-script.jar" -r "C:\path-to-skl\script.skl"
sikuli-ide.jar is just to launch the IDE.

However for the exe, I think you can write a code in C who launch the java with the parameter above.

Or, there is some program who wrapping a jar and produce an exe.
See this link for example: http://launch4j.sourceforge.net/

Regards.

Revision history for this message
Test (c4456517) said :
#2

I already tried that command and received the popup as shown above.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

@obiwan
sorry, but I have to correct (and I do that because sikuli-script.jar will be deprecated with version 1.1.0, since everything can be done with sikuli-ide.jar)

@Test
I have left the start up dialog, to give a chance to set other parameters.
If you want to suppress the start-up dialog, use:
java -Dsikuli.FromCommandLine -jar "C:\path-to-sikuli\sikuli-ide.jar" -r "C:\path-to-skl\script.skl"

BTW: naming a .skl as an executable brought confusion to newbees since the first days of Sikuli. A .skl is simply a zipped version of the respective .sikuli folder and as such has nothing to do with what Windows users would expect hearing the term executable.

Version 1.1.0 will have some basic packaging support for a jar file, that can just be run using java -jar my script.jar and might then further be wrapped with tools like the mentioned launch4j

Revision history for this message
obiwan-92 (obiwan-92) said :
#4

@RaiMan
-- sikuli-script.jar will be deprecated
Copy that, so for the regular .sikuli, the command launch will be
java -Dsikuli.FromCommandLine -jar "C:\path-to-sikuli\sikuli-ide.jar" -r "C:\path-to-skl\script.sikuli"
What is it the -Dsikuli.FromCommandLine ?

Revision history for this message
Test (c4456517) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
Test (c4456517) said :
#6

@obiwan:

-Dsikuli.FromCommandLine as RaiMan mentioned, suppresses the prompt received when this command is omitted. The prompt looks like this: http://i.imgur.com/7RotHec.png

Revision history for this message
RaiMan (raimund-hocke) said :
#7

@obiwan
this "solution" was a quick-and-dirty fix for the above mentioned case and is used in the runIDE.cmd

With version 1.1.0 there will only be a sikulix.jar (being sikuli-ide.jar AND sikuli-script.jar - which sikuli-ide now already is in fact) and the dialog will only come up, if you run it without any parameters.

Revision history for this message
obiwan-92 (obiwan-92) said :
#8

@RaiMan and Test
Thanks a lot.
Have a nice day.

Revision history for this message
deva (deva-n) said :
#9

Hi RaiMan

i am using sikuli version 1.1.0. i want to create batch file to run .skl file.

could you help on it!

Revision history for this message
RaiMan (raimund-hocke) said :
#10

@deva
do not ask in comments - use your own question (may be with a reference to another question)

... but if you do like here, then subscribe to the question (I subscribed you this time as a one time service ;-)

your question:

java -jar <path-to>sikulix.jar -r <path-to>some.skl

is the command to use in the batch file