0

I have a .exe program that is converting an AGS file to an Excel file. I have a lot of files to convert so I'm wondering can I automate this with Python? The convert-program only requires 2 locations, one for the input and one for the output, see the picture.

enter image description here

With Python I'm albe to start the program with the following code, but is it possible to pass the 2 path's and click Export.

import subprocess
path = r'C:\Program Files (x86)\AGSToExcel.exe'

#Start the programs
subprocess.call([path])

#other locations
path_ags = r'C:\Users\X\Documents\AGS_file1.ags'
path_excel = r'C:\Users\X\Documents\Book1.xls'

I'm fairly new with package subprocess so I have not a clue if this is even possible.

1 Answer 1

1

You can probably use pyautogui to click and type if needed. You can see a simple example here.

PyAutoGUI EXAMPLE

Sign up to request clarification or add additional context in comments.

2 Comments

PyAutoGUI would be great for this. You'll have to define a way to generate the excel file names programatically so that you don't overwrite anything, and make sure that your filesystem is organized so that you can simply loop through all the items in a directory for the conversion process.
Thanks, this helped a lot. I used os.listdir and pyautogui.typewrite to list all the files in my folder, loop through all files and type the path in the program.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.