Hi,
Managed to use the file editing as described below. Does the job.
void show_file(string strfile = "htdr2001macros.cnf") // old macro file
{
string LTString;
string striFilename = GetAppPath() + strfile;
string stroFilename = GetAppPath() + "ftemp.cnf";
if(!DeleteFile(stroFilename)) {};
stdioFile ffo(stroFilename,file::modeCreate | file::modeReadWrite);
stdioFile ff;
bool bRet = ff.Open(striFilename, file::modeRead);
if(!bRet)
{
out_str("file not found!");
return;
}
string strTemp;
int CopyThis=0;
int CopyLine;
while(ff.ReadString(strTemp))
{
if((strTemp.Left(4).CompareNoCase("def ")==0)&&(CopyLine>1)) CopyThis=0;
if(strTemp.CompareNoCase("def displaygraphall {")==0) {
CopyThis=1;
}
if(CopyThis==1) {
//out_str(strTemp);
CopyLine++;
if(CopyLine!=1) {
ffo.WriteString(strTemp);
} else {
ffo.WriteString("def TempMacro {");
}
}
}
ff.Close();
ffo.WriteString("");
ffo.WriteString("def DisplayGraphall {");
ffo.WriteString("TempMacro;");
ffo.WriteString("run.section(Smilesjpg.ogs,\"AddImagesToGraph\");");
ffo.WriteString("};");
LTString="run ftemp.cnf";
out_str(LTString);
LT_execute(LTString);
//if(!DeleteFile(stroFilename)) {};
}
adds the line run.section(Smilesjpg.ogs,AddImagesToGraph); to the end of the displaygraphall macro and then reloads/redefines this macro.
Cheers,
pete