Cannot start App when executing Sikuli script from cmd

Asked by sdraganov

Microsoft Windows [Version 10.0.17134.407]
java version "1.8.0_191"
Sikuli 1.1.4 Snapshow 2018/10/31

For some reason the application cannot run when script is executed from command line.
I'm using the following command inside .bat file which is started as Administrator:

"%~dp0sikuli\1.1.4\sikulix.jar" -r "%~dp0scripts\vray_max.sikuli"

When I open Sikuli IDE and run the same script from there the application is started normally.

I'm noticing that sometimes App is launched but it stuck on splashscreen and no matter how long I'm waiting it never launches successfully.

Any idea what might be wrong or what to inspect/debug ?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
sdraganov (sdraganov) said :
#1

OK here is an updated.
It looks like Sikuli prevents somehow application to be launched when it is executed from CDM.
When I start the application I'm looking for its interface 300second with the following command:

App.open(maxExecutable)
wait(img.max_viewport,300)

What happens is that Sikuli blocks the app for 300 second and when script failed due to not being able to find the image the application launches successfully.

Any clues why that might be happening?

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

Sorry, but I cannot reproduce this behavior with the latest build of 1.1.4 (app used notepad++) on my Windows 10 with Java 11.

Is this a fullscreen application?

Revision history for this message
sdraganov (sdraganov) said :
#3

I happens every time with Autodesk 3dsMax application with Java 11 as well.
Strange thing is it's work fine with version 1.1.3

Let me try with notepad and will let you know it's reproducible with it as well.

Revision history for this message
sdraganov (sdraganov) said :
#4

Yeap, it works fine with notepad, so there is something specific to 3dsMax application I'm using.
Any idea what to have a look?

Revision history for this message
sdraganov (sdraganov) said :
#5

Not sure what exactly do you mean by full-screen application, can you get me some examples?

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

A full-screen app in Windows 10 is an app, that gets a complete screen additionally to the normal window area on the desktop.

The App class now works a bit differently than in 1.1.3

Switch debugging on by using
Debug.on(3)
just before the App.open()

You might try another sequence (see the complete App features in the docs)
Debug.on(3)
app = App(maxExecutable)
app.open(10)
if not app.isRunning():
    print "not started", app
    exit(1)
Debug.off()
wait(img.max_viewport)

Revision history for this message
sdraganov (sdraganov) said :
#7

This approach actually blocks the application to start even when launched via IDE, with previous setup I was able to launch it from IDE, the issue only occured when launching sikuli-script from command line.

I captured the entire thing on video:
https://drive.google.com/uc?id=13KA1oG0tMSpW9oUJp2aRFPOEfCxLNXy4

The only difference from the proposed scripts is that I used 100seconds for App.Open command since the application is heavy and it needs more time to launch.
If you check the video you will noticed that sikuli starts launching the App, it's splash screen appears and it also appears in Background process in Task Manager, for some reason however it stops just before launching and stays there for 100 seconds until the script terminates.

The strange thing is that the App still doesn't launch after the script-termination. Notice that when I close the IDE everything gets back to normal and App is successfully launched.

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

I am sorry, but I have no idea.

To start the given executable internally a command execution is detached:
cmd /c start "" /B "path-to-executable"

To get the state of the app, internally this Win command is executed:
tasklist /V /FO CSV /NH /FI "IMAGENAME eq <executable>"

where <executable> is the executables name (from given executable path the name only as <name>.exe: 3dsmax.exe in your case)

Since from the code I cannot see any reason for blocking, I cannot help you currently.

I will revise the App.open() stuff a little bit, to get more info about what is happening and ask you to test again.

If it is urgent, then you have to implement your own app-start solution with os.Popen, that you already use apparently.

Revision history for this message
sdraganov (sdraganov) said :
#9

Don't worry I could use version 1.1.3 to run scripts from CMD, so far everything works as expected even though I'm using 1.1.4 for writing my scripts. There might be something hidden in the new implementation of the App-function however, I haven't got any issues with it in previous versions of the software, 1.1.4 is the first one that introduce this issue.

Let me know when you have something for testing, I'll be glad to give you a hand with testing.

Regards,
Svet

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

Thanks for feedback.

Did you try out the start command from comment #8?

Did you try to launch it using subprocess.Popen?

Revision history for this message
wiliamdevlin (wiliamdevlin) said :
#11

In my opinion, you should download shareit to replace the existing application, this is also a very reliable file transfer application that I use and do not see any errors, you can refer to this address https://shareitdownload.net/shareit-for-pc/

Can you help with this problem?

Provide an answer of your own, or ask sdraganov for more information if necessary.

To post a message you must log in.