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
  • Hi Ninja,

    I almost have this working. Only issue I am running into is the call to PCD2Excel. It works fine but it doesn't run automatically. It is as if the /A parameter is being ignored. The configure window pops up, I click "Continue", it does its thing, then I have to click "Finish." Did it work automatically when you tested your code?

    This is the code I'm using for that section (I have my PCD2Excel located in a non-standard directory):
    'Launch PCD2Excel Wizard to generate .CSV
      Shell ("C:\BladeRunner\PCD2EXCEL.exe /A")
    
      'Wait for process to end
        'Wait for process to end
      While IsExeRunning("PCD2Excel.exe")
       Sleep (5000)
       'MsgBox "PCD2Excel is running", 0, "Debug"
      Wend
  • Nevermind, I got it working. Just needed to change the code for calling PCD2Excel a bit:
    'Launch PCD2Excel Wizard to generate .CSV
    Dim strProgramName As String
    Dim strArgument As String
    strProgramName = "C:\BladeRunner\PCD2EXCEL.exe"
    strArgument = "A"
    Call Shell(strProgramName & " " & strArgument, vbNormalFocus)
Reply
  • Nevermind, I got it working. Just needed to change the code for calling PCD2Excel a bit:
    'Launch PCD2Excel Wizard to generate .CSV
    Dim strProgramName As String
    Dim strArgument As String
    strProgramName = "C:\BladeRunner\PCD2EXCEL.exe"
    strArgument = "A"
    Call Shell(strProgramName & " " & strArgument, vbNormalFocus)
Children
No Data