SikuliX on Linux Mint launch scrcpy from SikuliX script

Asked by Mike Praeuner on 2019-09-10

So.... I decided to migrate my SikuliX and scripts from my main system (W10) to an older computer (Linux Mint)
The Mint system has SikuliX latest version, with IDE functional (+ xdotool and wmctrl)
Because it is a older system instead of virtualization of Android I am using SCRCPY (with a tethered Android device) - which is installed via snap and working
I think other than a few adjustments (like the one below) the scripts will transition very well - and let me use my main system again to its full potential

From Terminal I run scrcpy -S

Using the app function in SikuliX what is the syntax to open this program as part of the script?

I also created and tried to execute the script, but I am missing something here as well
./ works from terminal / file manager gui (Home directory) but I am not having any luck getting it to launch from the SikuliX script

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Best RaiMan (raimund-hocke) said : #1<command-line-string>)

should work.

the java docs:
   * the given text is parsed into a String[] suitable for issuing a Runtime.getRuntime().exec(args). quoting is
   * preserved/obeyed. the first item must be an executable valid for the running system.<br>
   * After completion, the following information is available: <br>
   * App.lastRunResult: a string containing the complete result according to the docs of the run() command<br>
   * App.lastRunStdout: a string containing only the output lines that went to stdout<br>
   * App.lastRunStderr: a string containing only the output lines that went to stderr<br>
   * App.lastRunReturnCode: the value, that is returnd as returncode
   * @param cmd the command to run starting with an executable item
   * @return the final returncode of the command execution

It might be necessary, to give the script with its absolute pathname and as executable you might need to use the shell executable (bash I guess in this case).

Mike Praeuner (eris667) said : #2

That got me going in the right direction!

I ended up using:
        app ='gnome-terminal -e "scrcpy -S" &')
# reg = app.window(0)

The two commented out lines were from my windows script - they create a error now
App vs

Because scrcpy and sikuli both use the terminal for output I needed to spawn a separate terminal window

Mike Praeuner (eris667) said : #3

Thanks RaiMan, that solved my question.