← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #177227]: [Howto] import other Sikuli scripts

 

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

    Status: Answered => Open

jeromy is still having a problem:
Hi RaiMan,

   Thanks!

   It finally works, but I've got another two problem, the first is :"Seems
deleted the __init__.py won't get things work immediately, I've tried
several times, and finally by make modification, and run
FirefoxSettings.sikuli, and it works, I've seen there're something like
"C:\Users\jeromyf\AppData\Local\Temp\sikuli-tmp5259773085076353896.py",
what's this, a temp file? Why there're tmp files?

   Another new problem is that the match doesn't work, when open Firefox,
my script will wait for the navigate bar on the top left, I also tried
replace the old image with the newest one, still doesn't work.

   Any suggestions?


2011/11/4 RaiMan <question177227@xxxxxxxxxxxxxxxxxxxxx>

> Your question #177227 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/177227
>
> Description changed to:
> *** a summary of the easiest approach
>
> * first see docs:
>
> http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images
>
> * place all your .sikuli folders in one place,
> since Sikuli finds imports in the same directory as the main script
> automagically
>
> e.g.
>
> -- mySikuliSolution
>   -- main.sikuli
>   -- sub1.sikuli
>   -- sub2.sikuli
>   -- .... as many as needed
>
> * in each sub
> at the beginning of the script place
> from sikuli import *
>
> (for the experts: this is only needed if the sub uses Sikuli features)
>
> * in main.sikuli
> put at the beginning of the script import statements for the subs
> from sub1 import *
> from sub2 import *
>
> This makes available all names (variables, functions, classes, ...) from
> the subs in your main script. Additionally all images contained in the subs
> will be found automatically (with the import Sikuli updates the image path
> accordingly)
> Have a naming concept, to avoid naming conflicts and overwrites.
>
> * run the main script either in the IDE or from command line
>
> * If you make changes in the subs, you have to restart the IDE
> (for the experts: use reload() as mentioned in the docs)
>
>
> ----------------------------------------------------------------------------------------------------
>
> Hi all,
>
>   Sikuli IDE is very cool, it gives us an intuitive impression on the
> images we chosen, however, when I'm taking more modular structure of the
> project, and want to move each suit  of images into different resource
> folders, and replacing the raw resource string with CONSTANT var in one
> python file, I found that Sikuli IDE can't open the .py file, so it's
> inconvenience to edit the captured images.
>
> You received this question notification because you asked the question.
>

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