hexagon logo

Script to modify a series of .PRG files

I have a need to automate the following process:

Loop through a set of .PRG files that are in a common directory. For each file do the following:
1) Open the file
2) Locate a specific command in the program
3) Delete all commands in the program after the command located in step 2
4) Add a set of dimension commands after the command identified in step 2
5) Launch the PCD2EXCEL wizard to output a .CSV file containing the data from the commands added in step 4
6) Close the file

Has anyone had to do something similar? Is anyone willing to share their code for any or all of these actions?

Thanks for any help.
Parents
  • Yes, same program run on 1000+ parts over the course of several years. Just need to pull out some additional data that was not included in the original reports. There have been some changes to the program over the years but nothing dramatic. Feature names are consistent, alignments are consistent, etc. I have done this process manually on about 25 parts and it works fine. I just can't manage doing it manually on 1000+ parts.
Reply
  • Yes, same program run on 1000+ parts over the course of several years. Just need to pull out some additional data that was not included in the original reports. There have been some changes to the program over the years but nothing dramatic. Feature names are consistent, alignments are consistent, etc. I have done this process manually on about 25 parts and it works fine. I just can't manage doing it manually on 1000+ parts.
Children
No Data