← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #164015]: Saving documents made in external programs to specific paths using finder?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
-- 1) should I only use Sikuli for this?
clearly YES.
Everything you need can be done since we can do everything, that is possible with standard Python 2.5. Any available Python module, that is either written in plain Python 2.5 or available as a Jython ported version can be installed and used.

-- 2) How do I instruct Sikuli to navigate the finder window?
This is the easiest way (manually): In a standard Mac open dialog (that should come up with import), you can type /, which opens the "goto folder" dropdown, and then type the complete absolute path to your folder containing the import and hit enter. Then enter the complete file name including extension into the search field (top right) and hit enter. Click into the window part containing the file name and type Key.DOWN (which selects it) and hit enter (can be done with some tabs too ;-)

I cannot test it, since I cannot type("/") on my german keyboard. So if
you have a standard US installation, you might succeed in simulating
this sequence.

Another hack you might try, if type("/") does not work:
put your working directory into the finders left sidebar under places. It should have a name starting with a character/number, that is unique among all entries in the sidebar including the section headers. so in the open dialog you can tab to the side bar and type("x"), which should select your folder if it starts with an x.

--- 3) config file per patient
The first option is to use csv-files, since this is directly supported by the Jython that comes with Sikuli.
A good starting point: http://www.doughellmann.com/PyMOTW/csv/

To make this easy to handle, you should hold your patients data in a dictionary:
- since a dictionary can easily be loaded from the csv-file 
- and using a dictionary key is more readable than an array
 (p["client"] versus p[0])

p = {} # parameter set for a patient
p["client"] = "Henry3"
p["therapist"] = "someone"
p["location"] = "somewhere, somestate"
p["date"] = "month year"

# setup the title
templTitle = "%s\n Demo with %s \n%s\n%s"
p["title"] = templTitle % (p["client"], p["therapist"], p["location"], p["date"])

and similar for all the other data.

since a dictionary can easily be loaded from the csv-file.

Another option to use is YAML (which is more readable than a csv-file),
but for Python/Jython, YAML-load is an external module, that you can get
free from the web and you have to make it available to Sikuli Jython.

--- One more thing:
a trailing ; is not needed with Python. It is only necessary, if another statement is on the same line.

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