This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Find and Replace using Custom Dialog
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 23, 2008
09:59 AM
Find and Replace using Custom Dialog
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
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
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 23, 2008
01:54 PM
I have to do this a lot -- unfortunately it requires stepping out of InstallShield and using a custom action.
In my previous installations I had just created a very simple executable file that took 3 arguments -- a filename, string to search for, and string to replace. After learning about DTF (Thanks Chris Painter!) I now have some more complex .Net CA dll's that do regular expression searching, replacing, and match reformatting. It sounds like for what you are doing you can definitely get away with a simple search/replace executable.
In my previous installations I had just created a very simple executable file that took 3 arguments -- a filename, string to search for, and string to replace. After learning about DTF (Thanks Chris Painter!) I now have some more complex .Net CA dll's that do regular expression searching, replacing, and match reformatting. It sounds like for what you are doing you can definitely get away with a simple search/replace executable.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 24, 2008
07:47 AM
Hi,
I too have the same issue and i have been trying to use custom actions but was not able to figure out a way. Can anyone please suggest some examples or any help as to how to do it.
Any information is appreciated,
Thanks in advance
I too have the same issue and i have been trying to use custom actions but was not able to figure out a way. Can anyone please suggest some examples or any help as to how to do it.
Any information is appreciated,
Thanks in advance
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2008
04:39 AM
\*--------------------------------------------------------------*/
#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