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
  • 'loop through commands deleting once delete command flag has bees set to true
    
    For Each cmd In cmds
    
    If cmd.ID = cmdID Then
      deletecommandflag = True
    End If
    
    If deletecommandflag = True Then
    [COLOR=#FF0000]cmd.Remove[/COLOR]
    End If
    
    Next


    First day after vacation, so bear with me...
    What if replacing the red marked text with (pseudocode):

    SendKeys(SHIFT + CTRL + END) ' selects the text from deleteflag to program end
    Wait(250) ' lets give it time to select the text
    SendKeys(DELETE) ' delete the selected text
    


Reply
  • 'loop through commands deleting once delete command flag has bees set to true
    
    For Each cmd In cmds
    
    If cmd.ID = cmdID Then
      deletecommandflag = True
    End If
    
    If deletecommandflag = True Then
    [COLOR=#FF0000]cmd.Remove[/COLOR]
    End If
    
    Next


    First day after vacation, so bear with me...
    What if replacing the red marked text with (pseudocode):

    SendKeys(SHIFT + CTRL + END) ' selects the text from deleteflag to program end
    Wait(250) ' lets give it time to select the text
    SendKeys(DELETE) ' delete the selected text
    


Children
No Data