← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #189309]: For my second script, URL is not pasted properly

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--1. I think,

App.close("cmd")

does not make any sense if used in the master/sub configuration, because
this will close the command window, that the master is running in.

BTW 1:
from sikuli import *
is not needed in subs, if exec file is used.

--- Better solution:
If you decide to run master generally from command line and having all related .sikuli in one folder, this is better with current Sikuli X (the subs NEED from sikuli import * in this case):

*** master.sikuli
import script1
import script2

this will simply run both scripts one after the other.

might make sense, to insert a wait, after a script has run:
import script1
wait(3) # to give Firefox time to close
import script2

--- passing variables back and force is no longer possible using just variables. with this solution You might use for example Sikuli's Settings class to define and access variables in master and all subs
# e.g. in master
Settings.myValue = True

# and in sub:
if Settings.myValue:
    print "myValue is set"

--- So it is possible to decide, wether the sub is run as sub or standalone:
# in master:
Settings.runningAsSub = True

# and in sub
from sikuli import *
try:
    isSub = Settings.runningAsSub
except:
    isSub = False

if not isSub:
     pass # start Firefox
else:
     pass # supposing FF already running 

--- One more thing:
With newer versions of Firefox, closing a FF window might not close the FF process.
To access the address field you might use
type("l", KeyModifier.CTRL) # lowercase L

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