sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #59496
Re: [Question #818719]: Ability to act on files in a folder one at a time
Question #818719 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/818719
Status: Answered => Solved
JoeBloggs confirmed that the question is solved:
Hi Sean,
Thank you very much for your input. Much appreciated!
I've been able to open files from Sikuli using scripts similar to:-
App.open("C:\\TESTFOLDER1\\testfile.txt")
I'm able to get Sikuli to scan a windows folder and identify the first file in the folder:-
import os
# Specify the directory path
dir="C:\TEST"
# List all files in the directory
files = os.listdir("C:\TEST")
res = [files[0]]
print[files[0]]
I'm also figured out how to get Sikuli to scan a windows folder and report back what is the first file in that list, and print it out:-
import os
# Specify the directory path
dir="C:\TESTFOLDER1"
# List all files in the directory
files = os.listdir("C:\TESTFOLDER1")
res = [files[0]]
print[files[0]]
What I'm trying to do now is marry those two types of commands together
so that the folder is scanned and it passes the res=[files[0]] to the
open command so that it will open the first file in the list. Ideally,
once opened I can run other commands and possibly delete the file before
the script then runs again in a loop and moves onto the next file in the
directory and then process that.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.