Good morning,
Can anyone help me on the below.
I have file in my [INSTALLDIR] with name testfile.asa and I have two hardcoded strngs - String1 and String2 in that file. I would like to replace these strings as per user input. For this I have created a Custom diaog to accept the values. from here I am unable to proceed further to replcae these values in my file.
Can you please do the needful.
Warm Regards,
Ameer
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Help me on STRREPLACE
Started by
ameer
, Oct 27 2008 12:27
2 replies to this topic
Posted 27 October 2008 - 12:28
I am using the below code for the above
\*--------------------------------------------------------------*/
#define SOURCE_DIR INSTALLDIR
#define SOURCE_FILE "global.asa"
#include "Ifx.h"
export prototype globalsettings(HWND);
function globalsettings(hMSI)
STRING svLine, szNewString, svReturnLine, szMsg, svResult;
NUMBER nvLineNumber, nvResult;
begin
// Find the search string in the source file.
nvResult = FileGrep (SOURCE_DIR ^ SOURCE_FILE, "ameer" , svReturnLine, nvLineNumber, RESTART);
switch(nvResult)
case FILE_NOT_FOUND:
// Report error; then abort.
MessageBox( SOURCE_FILE + " not found.", WARNING);
abort;
case FILE_LINE_LENGTH:
// Report error; then abort.
MessageBox (SOURCE_FILE + "lines too long.", WARNING);
abort;
case OTHER_FAILURE:
// Report error; then abort.
MessageBox (SOURCE_FILE + "Unknown failure on call to FileGrep.",
WARNING);
abort;
endswitch;
// Loop until end of file.
while (nvResult != END_OF_FILE)
// Set up message string for SprintfBox.
szMsg = "'ameer' found in line %d of %s:\n\n'%s'";
// Report matching line from file.
SprintfBox (INFORMATION, "SISWeb Info", szMsg, nvLineNumber, SOURCE_FILE, svReturnLine);
// Search again.
nvResult = FileGrep (SOURCE_DIR ^ SOURCE_FILE, "ameer" , svReturnLine, nvLineNumber, CONTINUE);
endwhile;
StrReplace (svReturnLine , "ameer" , "suhaan" , 0);end;
anything wrong in the above script. I am getting the string through message box but it is not getting replcaed. can anyone help me..plz
\*--------------------------------------------------------------*/
#define SOURCE_DIR INSTALLDIR
#define SOURCE_FILE "global.asa"
#include "Ifx.h"
export prototype globalsettings(HWND);
function globalsettings(hMSI)
STRING svLine, szNewString, svReturnLine, szMsg, svResult;
NUMBER nvLineNumber, nvResult;
begin
// Find the search string in the source file.
nvResult = FileGrep (SOURCE_DIR ^ SOURCE_FILE, "ameer" , svReturnLine, nvLineNumber, RESTART);
switch(nvResult)
case FILE_NOT_FOUND:
// Report error; then abort.
MessageBox( SOURCE_FILE + " not found.", WARNING);
abort;
case FILE_LINE_LENGTH:
// Report error; then abort.
MessageBox (SOURCE_FILE + "lines too long.", WARNING);
abort;
case OTHER_FAILURE:
// Report error; then abort.
MessageBox (SOURCE_FILE + "Unknown failure on call to FileGrep.",
WARNING);
abort;
endswitch;
// Loop until end of file.
while (nvResult != END_OF_FILE)
// Set up message string for SprintfBox.
szMsg = "'ameer' found in line %d of %s:\n\n'%s'";
// Report matching line from file.
SprintfBox (INFORMATION, "SISWeb Info", szMsg, nvLineNumber, SOURCE_FILE, svReturnLine);
// Search again.
nvResult = FileGrep (SOURCE_DIR ^ SOURCE_FILE, "ameer" , svReturnLine, nvLineNumber, CONTINUE);
endwhile;
StrReplace (svReturnLine , "ameer" , "suhaan" , 0);end;
anything wrong in the above script. I am getting the string through message box but it is not getting replcaed. can anyone help me..plz
Posted 31 October 2008 - 18:07
Add some debugging to your script, like a MessageBox that would display the value of SOURCE_DIR ^ SOURCE_FILE . Then check if the file is actually there.
When are you calling this script? Before or after InstallFinalize? Immediate or Deferred?
When are you calling this script? Before or after InstallFinalize? Immediate or Deferred?
Stefan Krüger
InstallSite.org twitter facebook