New question #818719 on SikuliX:
https://answers.launchpad.net/sikuli/+question/818719

Hi,

Thanks in advance for any advice/pointers/comments!
I'm using Sikuli 2.05 and Java Runtime 1.8

I'm after a bit of advice/pointers on getting Sikuli to scan a folder and 
create a list of the contents and then be able to act on each file in turn.

Basically, I'm trying to create a 'drop folder' where files are placed in a 
folder and then Sikuli will scan the contents of the folder and if it sees 4 
files will open each file in turn in a CAD package, run a script on each file 
(amending the file and then exporting in a different file format) and then 
close once finished. 

I'm able to read the contents of the folder  and see the files if I run the 
following:-
e.g 

import os
dir="c:\\test"
for e in os.listdir(dir):
     filename=os.path.join(dir,e)
     print(filename)

This will show me the folder contents so I know Sikuli has found the folder and 
worked out what files are present:-
e.g 

c:\test\test1.doc
c:\test\test2.doc

I just don't know the next steps to get it to then open each file it knows 
about.

I've tried:-

Import os
dir=”c:\testfolder”
for e in os.listdir(dir):
        filename=os.path.join(dir,e)
        type(‘o’,KEY_CTRL)    # opens the location in the CAD software
        doubleClick(result)    # Problematical line to get it to double click 
on each file 
        click(export.png)        # to just export the file from the software
        ….                       # other actions        
        ….
        …..
Rest of script….

When ran this script will navigate to the drop folder, open one of the files in 
question, run through my processing and then, loop back to pick up another 
file. It will process the correct number of times. So, if there is 5 files in 
the 'drop folder' it runs through the 'loop' 5 times, before finishing. If 10 
files in the folder it will run through the 'loop' 10 times.
But each time it goes to just one file and opens that. Not the named files that 
it knows about.

If I ask it to look to doubleClick(image.png) then again it will run through 
the correct number of loops but picks up a random file each time. 
I understand that the line I'm using doubleclick(result) is probably wrong but 
don't know what I should be putting 


Hope the above question makes sense. I'm not a heavy computer user or 
programmer just a CAD operator that has been tinkering with Sikuli for a few 
years and got it to do most of what I want, but struggle with 
programming/scripting as my brain doesn't work that way :-) So, please forgive 
me if this appears a dumb question or simplistic for you geniuses (bit of 
blatant flattery...)

Thanks again for any assistance. 

Joe


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to