← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #256710]: How to talk to sikuli program that hangs permanently in memory

 

Question #256710 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/256710

    Status: Open => Answered

RaiMan proposed the following answer:
--- 1. yellow popup
You would not have it any more using version 1.1.0

But you will still have the startup time of about 3 seconds.
Besides having the Jython interpreter started (like in the IDE when you run a script the second time), there is no way, to shorten that time.

--- 2. simply use the available input methods
in version 1.1.0 there are much more options available, but already the simple input() can do the job:

command = "first run from args"
while True:
    # evaluate command 
    # run appropriate script
    command = input("what to do next?", "stop")
    if command.startsWith("stop"): break

--- 3. script run listener
So you need some "listening loop", that listens every time a scriptrun ends for a new run command.
You might use the clipboard for that or some texftile/Excel sheet, so that you change the content of clipboard/file via AHK, evaluate the content in the script and start the next script run.
You might combine it with hotkey usages in your listening script.

--- 4. use XML-RPC (or some other client-server construct)
Python has a simple to use XML-RPC server, that can be used to start scripts running in the server context on requests, sent by any XML-RPC client (even works over the net).

For every solution, the scripts should be packed in
modules/classes/functions, to be flexible.

To make it a bit more generic, we have the exec() function in Python and
eval() often is handsome too.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.