My script running perfectly through batch file but giving error in the end

Asked by sami baig on 2017-12-28

Hi RaiMan,

My script running perfectly with below command line but it is taking more than 1 minute to start and at the end of the script showing FATAL ERROR "System.out is broken (console output)!, You will not see any message anymore! Save your work and restart the IDE!"

command line:

#start
PATH-TO-IDE -r PATH-TO-SIKULI SCRIPT —args a1 a2 a3
#end

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
sami baig
Solved:
2017-12-31
Last query:
2017-12-31
Last reply:
2017-12-30
RaiMan (raimund-hocke) said : #1

Try with

java -jar <path-to>/sikulixapi.jar -r <path-to>/script -- a1 a2 a3

tested with SikuliX 1.1.2 - works and startup should be some seconds

sami baig (gabbarmic) said : #2

Should I upgrade SikuliX further ? because it is not working on SikuliX 1.1.1.

When I click on batch file, it is just open then close command prompt and nothing else.

Code:

java -jar D:\SikuliX\sikulix.jar -r "D:\ProjectKiosk\batfiles\Kiosk bats\test.sikuli" — a1 a2 a3

sami baig (gabbarmic) said : #3

using this code which just open and close command prompt but nothing else:

java -jar E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2 a3

While below code is working without "java -jar" but it takes time to start:

E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2 a3

sami baig (gabbarmic) said : #4

Any Idea how should I trigger?

RaiMan (raimund-hocke) said : #5

before baking things into scripts/batchfiles, you should manually check on a commandline:

- open a commandline window
- enter
java -jar E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2 a3

so you can see the output

to debug use:
java -Dsikuli.Debug=3 -jar E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2 a3

the output might reveal the problem

sami baig (gabbarmic) said : #6

Giving below FindFailed error on this code: java -jar E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2 a3

[error] JythonSupport: execFile: returns:
Traceback (most recent call last):
  File "D:\ProjectKiosk\Scripts\test2.sikuli\test2.py", line 5, in <module>
    doubleClick("1514219980851.png")
  Line 2759, in file Region.java

        at org.sikuli.script.Region.wait(Region.java:2759)
        at org.sikuli.script.Region.find(Region.java:2336)
        at org.sikuli.script.Region.getLocationFromTarget(Region.java:3213)
        at org.sikuli.script.Region.doubleClick(Region.java:3745)
        at org.sikuli.script.Region.doubleClick(Region.java:3730)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)

org.sikuli.script.FindFailed: FindFailed: 1514219980851.png: (69x75) in S(0)[0,0 1366x768] E:Y, T:3.0
  Line 2759, in file Region.java

Giving debug on this code: java -Dsikuli.Debug=3 -jar E:\SikuliX1.1.1\sikulixapi.jar -r D:\ProjectKiosk\Scripts\test.sikuli -- a1 a2

[debug] Debug.init: from sikuli.Debug: on: 3
[debug] RunTimeINIT: loadOptions: check: C:\Users\Sami
[debug] RunTimeINIT: loadOptions: check: C:\Users\Sami
[debug] RunTimeINIT: loadOptions: check: C:\Users\Sami\AppData\Roaming\Sikulix\SikulixStore
[debug] RunTimeINIT: global init: entering as: API
[debug] RunTimeINIT: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] RunTimeINIT: Monitor 0: (0, 0) 1366 x 768
[debug] RunTimeINIT: runs as sikulixapi.jar in: E:\SikuliX1.1.1
[debug] RunTimeINIT: exists libs folder at: C:\Users\Sami\AppData\Roaming\Sikulix\SikulixLibs_201703300100
[debug] RunTimeINIT: addToWindowsSystemPath: added to systempath:
C:\Users\Sami\AppData\Roaming\Sikulix\SikulixLibs_201703300100
[debug] RunTimeINIT: checkJavaUsrPath: added to ClassLoader.usrPaths
***** show environment for API (build 201703300100)
user.home: C:\Users\Sami
user.dir (work dir): C:\Users\Sami
user.name: Sami
java.io.tmpdir: C:\Users\Sami\AppData\Local\Temp
running 32Bit on Windows (10.0) from a jar
java 8-32 version 1.8.0_152-b16 vm 25.152-b16 class 52.0 arch x86
app data folder: C:\Users\Sami\AppData\Roaming\Sikulix
libs folder: C:\Users\Sami\AppData\Roaming\Sikulix\SikulixLibs_201703300100
executing jar: E:\SikuliX1.1.1\sikulixapi.jar
*** classpath dump sikulix
  0: /E:/SikuliX1.1.1/sikulixapi.jar
*** classpath dump end
***** show environment end
[debug] RunTimeAPI: global init: leaving
[debug] RunTimeAPI: initAPI: entering
[debug] RunTimeAPI: resourceList: enter
[debug] RunTimeAPI: resourceLocation: (class org.sikuli.script.RunTime) /Lib/sikuli
[debug] RunTimeAPI: resourceList: having jar: jar:file:/E:/SikuliX1.1.1/sikulixapi.jar!/Lib/sikuli
[debug] RunTimeAPI: files exported: 7 from: Lib/sikuli to:
 C:\Users\Sami\AppData\Roaming\Sikulix\Lib\sikuli
[debug] RunTimeAPI: initAPI: leaving
[debug] Runner: commandline:
[debug] --- Sikuli parameters ---
[debug] 1: -r
[debug] 2: D:\ProjectKiosk\Scripts\test.sikuli
[debug] --- User parameters ---
[debug] 1: a1
[debug] 2: a2
[debug] 3: a3
[debug] Runner: givenScriptName:
D:\ProjectKiosk\Scripts\test.sikuli
[debug] Runner: Trying to run script:
D:\ProjectKiosk\Scripts\test.sikuli\test.py
[debug] JythonSupport: init: starting
[debug] JythonSupport: trying to use setup downloaded Jython:
C:\Users\Sami\AppData\Roaming\Sikulix\SikulixDownloads\jython-standalone-2.7.0.jar
[debug] RunTimeAPI: addToClasspath:
file:/C:/Users/Sami/AppData/Roaming/Sikulix/SikulixDownloads/jython-standalone-2.7.0.jar
[debug] JythonSupport: init: success
[debug] JythonSupport: SikulixForJython: init: starting
[debug] RunTimeAPI: resourceLocation: (class org.sikuli.script.RunTime) /Lib/sikuli/Sikuli.py
[debug] JythonSupport: sikuli/*.py not found on current Jython::sys.path
[debug] JythonSupport: added as Jython::sys.path[0]:
C:\Users\Sami\AppData\Roaming\Sikulix\Lib
[debug] JythonSupport: added as Jython::sys.path[0]:
C:\Users\Sami\AppData\Roaming\Sikulix\Lib\site-packages
[debug] JythonSupport: SikulixForJython: init: success
[debug] Jython: sikuli: Sikuli: starting init
[debug] RunTimeAPI: loadLib: VisionProxy.dll
[debug] Mouse: init start
[debug] Mouse: init end
[debug] RunTimeAPI: loadLib: WinUtil.dll
[debug] Jython: requested to use as default region: S(0)[0,0 1366x768]
[debug] Jython: sikuli: Sikuli: ending init
[debug] ImagePath: new BundlePath:
/D:/ProjectKiosk/Scripts/test.sikuli/
[debug] ( Ctrl ) TYPE "g"
[debug] Region: ( Ctrl ) TYPE "g"
[debug] TYPE "#BACK."
[debug] Region: TYPE "#BACK."
[debug] TYPE "O34#ENTER."
[debug] Region: TYPE "O34#ENTER."
[debug] ( Ctrl ) TYPE "c"
[debug] Region: ( Ctrl ) TYPE "c"
[debug] RunTimeAPI: final cleanup
[debug] FileManager: deleteFileOrFolder:
C:\Users\Sami\AppData\Local\Temp\Sikulix_408412975

C:\Users\Sami>O34
'O34' is not recognized as an internal or external command,
operable program or batch file.

RaiMan (raimund-hocke) said : #7

LOL: the image is not found on the screen - so check why !!

sami baig (gabbarmic) said : #8

Oh! yes :D

sami baig (gabbarmic) said : #9

but any idea ? why it is taking more than 10 seconds to start clicking :)

RaiMan (raimund-hocke) said : #10

you have to live with this 10 seconds at start of one scriptrun:
time is consumed by the internal setup of the Jython SikuliX runtime environment.

To create a solution, where snippets can be run without delay, have a look at the hotkey feature:
http://sikulix-2014.readthedocs.io/en/latest/interaction.html#listening-to-global-hotkeys

together with
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other