Opening and exporting a file one after another

Asked by DavidJSBriscoe

My task is very similar to the one detailed in this post

https://answers.launchpad.net/sikuli/+question/203363

I would like to open each file in a global fixed directory one at a time (for example C:\Circuit_Wizard_Files).
I need to open 1 file and then export the same file using a another GUI dialog.
This involves clicking on file -> CAD/CAM -> Export Gerber then a dialog box appears.
In this dialog box I DESELECT two options in a list box and then click an up box to increase a number and then choose an option from a combobox.
After this I click OK and the named file gets exported
(this creates 3 files with extensions .drl,.gbo and .gb1 with the same filename as the original opened file).
I have managed to start the application and launch an open file dialog with the following sikuli code.

click("1387641400188.png") #Click START
wait("1387645449516.png") #Wait for start menu to appear
hover("1387646128594.png") #Place cursor on the CircuitWizard menu item
click("1387646185516.png") #Click on this menu item
wait("1387646378906.png",30) #Wait 30 seconds for Circuit Wizard to start up
hover("1387646416609.png") #Place cursor on File menu item
click("1387647210859.png") #Click on this menu item
wait("1387647345938.png") #Wait for drop down menu to appear
hover("1387647481031.png") #Place cursor on the Open menu item
click("1387647445109.png") #Click on this menu item

I want to open files (all with the same extension .cwz but DIFFERENT filenames) from the SAME directory everytime.
I have 8 sample files already placed in the diectory above ready for testing. Can I select this directory from
WITHIN the script or do I HAVE to use the screenshot method as in the code above.

As a first task I would like to open and process just 1 file.Then I would like put the steps required into a loop
that can process the 8 (for example) files in succession (or stops when they are all done if possible).
Later after I have exported the files to gerber I want to also move the processed files one at a time
to a new directory (named DONE-21-12-13 for example).

Could someone please help me get further along with this task? I am quite pleased and surprised with how far
I've got so far so hopefully I can do more with your help.
Any assistance appreciated.
Thank you.

David.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
obiwan-92 (obiwan-92) said :
#1

Hello.

I'm sorry, I don't understood exactly what you trying to do, so I won't be too accurate.

# Once you are in your directory:
for file in findAll("a_cwz_capture.png"):
    doubleClick(img) # Presume you open it like this
    # Check what you have to check
    type(Key.F4, KeyModifier.CTRL) # Close your application (you can click on the red cross too ;-))

Hope it's help.

Regards.

Can you help with this problem?

Provide an answer of your own, or ask DavidJSBriscoe for more information if necessary.

To post a message you must log in.