← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #190179]: Using Variables via Settings, refresh?

 

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

    Status: Needs information => Open

David Lafferty gave more information on the question:
Apologies for the naming convention. Yes there is a Main.sikuli script.
That script as you have correctly guessed contains:
# main.sikuli
Settings.myClientName = "Sikuli " + time.strftime("%Y/%m/%d - %H:%M.%S")
import CreateAClient
reload(CreateAClient)
import NBWrapUp
reload(NBWrapUp)

And within the other two sikuli files, they make use of this variable.

What I was trying to achieve is that everytime I run the Main.sikuli,
which in turn runs all the scripts I've wrote altogether I wanted the
"global variable" to be the current time & date. It seemed that whilst
doing incremental development and testing each new part in turn, the
myClientName variable was not being refreshed. It was constantly
spitting out the initial time and date.

I've temporarily put the declaration of the variable within it's own sikuli file called initVariables.sikuli which does what it says on the tin. Doing it this way I can use the reload(initVariables) method which seems to be refreshing the myClientName variable.
Is there another way, some syntactical way of doing this without using another file, or would you recommend using other files?

-----------

Also, I've noticed that using import(file1) and then reload(file1) #to capture any changes during development.
Sometimes causing the first file to repeat it's execution.
I tried wrapping the import(file1) in an if statement but this seemed to have no affect, attempting if the import works, don't reload the file. I may be misunderstanding the use of the import/reload function however.

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