How to pass arguments to Sikuli script run without the IDE
I have set up an automation framework that launches Sikuli scripts on multiple remote virtual machines in parallel, then collects the results.
Since the scripts are the same, they somehow need to know that they are running under different scenarios (use different login credentials, etc.). I would like to be able to pass command line parameters to Sikuli scripts.
Right now, there's a runner (essentially a webserver) that receives requests over HTTP with script names, launches them, collects their console output, and returns that in an XML format for the mothership to process and analyze.
Here's the command that the runner uses to launch scripts:
java -Xms64M -Xmx512M -Dfile.
When I try to supply arguments to it using the --arg switch provided in the documentation, sikuli-script.jar seems to treat them as the names of sikuli scripts to run. Here's an example. The testArg.sikuli script simply prints out the content of sys.argv:
===============
File: testArg.sikuli
===============
import sys
print "I will print all values in argv\n"
for a in sys.argv:
print a
===============
Then I launch it with this command:
java -Xms64M -Xmx512M -Dfile.
This is the console output I get:
===============
[error] Can't run this Sikuli script: --arg
java.lang.
at java.lang.
at org.sikuli.
at org.sikuli.
at org.sikuli.
[error] Can't run this Sikuli script: firstargument
java.lang.
at java.lang.
at org.sikuli.
at org.sikuli.
at org.sikuli.
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
I will print all values in argv
. estArgv.sikuli
--arg
firstargument
.\testArgv.sikuli
===============
It seems like the testArgv.sikuli script does get a hold of command line parameters in sys.argv, but the jar archive still treats them as sikuli script names.
Any ideas on how to tackle this? Thanks!
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Andrew P for more information if necessary.