sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #09789
[Question #193287]: Problems when running javaw.exe or java.exe with hidden console
New question #193287 on Sikuli:
https://answers.launchpad.net/sikuli/+question/193287
I am writing a script to automate a gui. I am not a python guru and have found Sikuli a little bit lacking in that it has no way to natively check for a window without making that window take focus. Because of the high level of CPU utilization a find operation takes, I found it necessary to use an AutoIt script to check for the existence of windows and then send hotkeys which Sikuli will then intercept to perform the various find operations when the appropriate window is in the foreground.
My scripts seemed to be working well in test, but as soon as I turned off my debugging I had issues.
Below seems to be the relevant code - basically my Sikuli script awaits a ctrl+alt+shift+l event from my other script and when that is received (meaning the necessary window has been brought to the foreground) we await the NET.PNG to first show up on the screen, and then to disappear (e.g. a splash screen). Once that completes the fullscreen.png is found (using a restricted region) and clicked:
def appLaunch(event):
if debug == 1:
print("debug: in appLaunch(C+A+S+L)")
wait("NET.png",FOREVER)
if debug == 1:
print("debug: loading...")
waitVanish("NET.png",FOREVER)
if debug == 1:
print("debug: done loading")
setControlBarRegion()
wait("FullScreen.png",2)
click("FullScreen.png")
setROI(getScreen())
def setControlBarRegion():
screenHeight = SCREEN.h
regionTop = (SCREEN.h/10)*7
regionBottom = screenHeight-regionTop
setROI(0,regionTop,SCREEN.w,regionBottom)
debug = 1
setFindFailedResponse(SKIP)
Settings.MoveMouseDelay = 0
Env.addHotkey("l", KeyModifier.ALT+KeyModifier.SHIFT+KeyModifier.CTRL,appLaunch)
x=1
while True:
sleep(1)
I launch the Sikuli script from within my other script (for ease of management). If I launch the Sikuli script using the following, everything seems to work fine:
cmd.exe /k java.exe -jar sikuli-script.jar myscript.sikuli
In this case my app launches the comspec and I have the java console available to see debug commands. All seems to work fine. However if I launch the same command in a hidden window (no UI visible) of if I use javaw.exe to launch the script things do not work. Additionally, since it seems to still be searching with the wait() commands, my CPU function is through the roof and it is difficult to do anything on the machine without forcibly killing the process.
I can verify if I comment out this hotkey that my other hotkeys (not shown here for brevity) continue to work - so it isn't a problem with the hidden UI not being able to intercept keys.
I know my syntax isn't perfect, and perhaps there is a cleaner way to achieve what I am trying to do above that may not be subject to the problem I am having. If we can identify and fix the root cause that would be great, but syntax that would allow me to avoid it would also be welcome.
I need to be able to run either in javaw or with a hidden java.exe console so that the user does not see the debug output.
Thanks for your assistance!
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.