← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #154960]: how to open a file, save then open next file in list

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
If you want to do it in Sikuli, this is a base: (it is just Python)

import os
theBase = "absolut-path-to-a-folder-containing-your-files"
for f in os.listdir(theBase):
   absName = os.path.join(theBase, f)
   print f # here goes your function

this prints all the files in the given folder in turn with its absolute
path.

On Mac you can submit an open command to the command line:

open "name-of-afile" -a "application to use"

to submit this from the script use os.popen:

os.popen('open "name-of-afile" -a "application to use"')

take care for the correct apostrophes. if filenames contain blanks these
have to be masked with \

this tells "application to use" to open the file "name-of-afile".

then you could use
switchApp("application to use")
type("s", KEY_CMD)

to tell your app to save the file again.

hope it helps

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