Jump to content


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.
Photo

InstallScript Custom Action


1 reply to this topic

narapark

narapark
  • Members
  • 18 posts

Posted 13 June 2003 - 15:56

Hi,

I am trying to run my function called UpdateConfigFile using Custom Actions but my function does not seem to get executed at all. I did not have any compilation error nor run-time error.

This is what I did:

1. Created a script called 'UpdateConfigFile.rul' in InstallScript View as below:

-------------------------------------------------------------------------------------------

///////////////////////////////////////////////////////
//
// Function: UpdateConfigFile
// Purpose: Updating the AuthoringManager.exe.config
//
////////////////////////////////////////////////////////

#include "ifx.h"
#include "isrt.h"
#include "iswi.h"

export prototype UpdateConfigFile();

function UpdateConfigFile()
STRING ConfigFile, RepositoryDir, svReturnLine;
INT nvLineNumber, nResult;


begin
ConfigFile = INSTALLDIR + "\\Software\\XXX.config";
RepositoryDir = "<add key=\"AAA\" value= \"\"\" + NEWDIR + \"\"\" />";
nResult = FileGrep(ConfigFile, "AAA", svReturnLine, nvLineNumber, RESTART);

if (nResult = 0) then
if (FileInsertLine(ConfigFile, RepositoryDir, nvLineNumber, REPLACE) < 0) then
MessageBox("Unable to update the default Repository directory in XXX.config file", SEVERE);
endif;
endif;
end;

-----------------------------------------------------------------------------------------
This function is supposed to delete a line in xml config file and replace with another line. NEWDIR is a directory like INSTALLDIR that should hold destination path - this value is from a dialog called AskDestPath2 that I have created (exactly same as default sdAskDestPath dialog) in Setup.rul.

2. Then in Custom Actions View, I have created New InstallScript with properties as below:

- Synchronous (Ignores exit code)
- Deferred Execution
- After InstallFiles.

3. Build & Install.

The end result is that the config file has not been modified at all.

Could anyone tell me what I am doing wrong here please? sad.gif

I am using Developer 8.02

Many thanks.

Edited by narapark, 13 June 2003 - 15:57.


Kiril

Kiril
  • Members
  • 39 posts

Posted 30 June 2003 - 06:36

As I understood you have added new .rul (UpdateConfigFile.rul) a file in the project.

Have you added “include” command in the setup.rul?
You must insert in the setup.rul file new line: #include "UpdateConfigFile.rul" and recompile a code.

I beleive that it will help you .

Kiril