If you need to make a series of permenant changes to the VB6 source that you get from a client, for example to make it ready for running and testing in a specific environment, you can use the gmPF fix command. Not to be confused with compile/fix, the gmBasic fix command is a top-level command that does a search and replace on a specific named file.'
For example: The following script will do a search and replace and write the modified file to disk:
<gmBasic> <Storage Action="Create" Identifier="VB6Edit" /> <Select Progress="1"/> <Fix name="Pre-Edit" fileFilter="C:\gmClients\Mertrix\src\Mertrix\Claims_Administration\SourceCode\frmDBselect.frm"> <Replace name="frmDBselect.frm"> <OldBlock><![CDATA[ mainModule.strprimaryConnection = "Provider=SQLOLEDB;Integrated Security=SSPI;" & _ "Initial Catalog=" & cboDB.Text & ";Data Source=" & cboServer.Text & ";Network Library=dbnmpntw" ]]></OldBlock> <NewBlock><![CDATA[ cboServer.Text = "GMI-CS-02.gmi.local" 'GM fix: modify ConnectionString for GM Lab mainModule.strprimaryConnection = "Provider=SQLOLEDB;Integrated Security=SSPI;" & _ "Initial Catalog=" & cboDB.Text & ";Data Source=" & cboServer.Text & ";" 'Network Library=dbnmpntw" ]]></NewBlock> </Replace> </Fix> <Storage Action="Close" /> </gmBasic>
Produces the following log:
Basic Processor V20.01(Beta.003) System Build(12/03/13 13:51:18)
REPLACE Line=[7] Lang=[All] Name=[Pre-Edit:frmDBselect.frm] host=[C:\gmClients\Mertrix\src\Mertrix\Claims_Administration\SourceCode\frmDBselect.frm] Type=[ReplaceGlobal]
Translation Time (sec) = 0.11\
The editing script is an example of a special purpose script, that can be added to a gmproj file so that it is handy for executing on new versions of the source as needed.
SrcName = [MertrixVB6_Edit]
SrcProj = [C:\gmClients\Mertrix\proj\usr\MertrixVB6_Edit.xml]
SrcType = [XML]
BldType = [CUSTOM]
TScript = [C:\gmClients\Mertrix\proj\usr\MertrixVB6_Edit.xml]