Cannot see or print args to command line --- use Sikuli-IDE.bat

Asked by matt

Hi Guys,

Apologies as I know this topic has been covered a lot, I have tried everything but still cannot seem to make any progress.

I am trying to print to the command line when running from command line, then trying to print an argument to the command line. E.g.

C:\Sikuli-r930-win32\Sikuli-r930-win32\Sikuli-IDE\Sikuli-IDE.exe -r "C:\TestLoopAddToList.sikuli" --args "testdata"
Note I have also tried:
C:\Sikuli-r930-win32\Sikuli-r930-win32\Sikuli-IDE\Sikuli-IDE.exe -r "C:\TestLoopAddToList.sikuli" --args arg1 arg2

Then using:

import sys
parms = sys.argv[1:]
for i in range(len(parms)):
      print "The Text below should display testdata"
      print params[i]

I am hoping to see the static text printed to the command line, followed by the text I entered as an argument, however neither display. As you can see I am running the Sikuli-IDE opposed to Sikuli script.

Any help would be greatly appreciated!

Cheers,
Matt

Question information

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

use
Sikuli-IDE.bat

instead of
Sikuli-IDE.exe

and you will succeed ;-)

Revision history for this message
matt (mattcmf) said :
#2

hey Raiman,

Thanks for the response.
I tried that, it seems to be running, however I get what I think is the run log appearing as a pop up so large I cannot close it without pushing enter.

Any ideas?

Revision history for this message
matt (mattcmf) said :
#3

Update: I've also tried this just running a vanilla script
print "123"

Running as follows:
C:\Sikuli-r930-win32\Sikuli-r930-win32\Sikuli-IDE\Sikuli-IDE.bat -r "C:\test123.sikuli"

which results in the same.

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

Use the -s parameter, to get the error message to the command line.

(see docs ;-)

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

I guess your environment setup is a mess, since you did not use the installer and you have to set it up on your own.

see faq 2005

Revision history for this message
matt (mattcmf) said :
#6

Got it working.

I found an old topic where you mention a run file. The run file was running the java file directly. I then changed it to the bat file as below:

@echo off
set OLDPATH=%PATH%
set SIKULI_HOME=%~d0%~p0
PATH=%SIKULI_HOME%libs;%ProgramFiles%\Java\jre6\bin;%PATH%
C:\\Sikuli-r930-win32\Sikuli-r930-win32\Sikuli-IDE\Sikuli-IDE.bat -s -r "C:\test123.sikuli" --args arg1
PATH=%OLDPATH%

Running using the following:
runsikuli.cmd C:\test123.sikuli

Ran this and worked like a charm! I think it may have had something to do with the path. Anyway thanks for the help and I hope this helps anyone else solve any issues they are having.