cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wheinsohn
Level 4

INSTALLDIR not resolved

The following InstallScript code does not function as intended, asit does not resolve the INSTALLDIR para. To verify the right setup, the messagebox is build in, but the output only shows: "cmd = appserver\jsl\service.exe". Anybody knows why?

Maybe it involves the properties of the custom action which has the following entries:
Return Processing: Synchronous(check exit code)
Install Exec Sequence: After InstallServices
Install Exec Condition: Not Installed
(Other fields hold default values)


[PHP]#define MY_SERVICE INSTALLDIR^"appserver\\jsl\\service.exe"
function addService(hMSI)
string szProgram, szCmdLine, szReturn;
number nOptions, nReturn;
begin
szCmdLine = "-install";
MessageBox ("cmd = " + MY_SERVICE + " " + szCmdLine, INFORMATION);
nOptions = LAAW_OPTION_WAIT;
nReturn = LaunchAppAndWait ( MY_SERVICE, szCmdLine, nOptions );
NumToStr(szReturn, nReturn);
MessageBox ("ReturnCode = " + szReturn, INFORMATION);
end;[/PHP]

edit: added information
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

Since custom actions have limited access to properties during the script execution phase of the installation, your deferred custom action can get properties by using the CustomActionData property. See Q104413 for more information. Also, you need to change your code like this:


nvBuffer = 256;
MsiGetProperty(hMSI, "CustomActionData", svReturnValue, nvBuffer);
szProgram = svReturnValue ^ "appserver\\jsl\\service.exe";
0 Kudos
wheinsohn
Level 4

Thanks for the KB Link and the code, but I still can't get it to work properly. Either the syntax of my calls or the timing seems the cause for this issue.

I did the following:

1. Created a new custom action "setPropertyInstallDir" with the following settings:
PropertyName: DeferredCustomActionName
PropertyValue: [INSTALLDIR]
ExecutionScheduling: Always execute
InstallExecSequence: After LaunchConditions
(other fields have default values)

2. Created "addService" method (with both ways to find the right call):

nvBuffer = 256;
MsiGetProperty(hMSI, "DeferredCustomActionName", svReturnValue, nvBuffer);
MessageBox (svReturnValue, INFORMATION);

MsiGetProperty(hMSI, "CustomActionData", svReturnValue, nvBuffer);
szProgram = svReturnValue ^ "appserver\\jsl\\service.exe";
szCmdLine = "-install";
MessageBox ("cmd = " + szProgram + " " + szCmdLine, INFORMATION);


3. Created a custom action to call the "addService" method with the following settings:
Function Name: addService
Return Processing: Synchronous (Check exit code)
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After Install Services
Install Exec Condition: Not Installed


hopefully the information is enough to solve my problem.
0 Kudos
DLee65
Level 13

Hmmm, the custom action you are executing is a deferred custom action.

Lets say your deferred custom action name is "ConfigureSystem".

In your setProperty custom action the name of the property must be the same as your deferred custom action. So the property name will be "ConfigureSystem" and the value would be [INSTALLDIR].

Now in the InstallScript code for "ConfigureSystem" the only property you need to fetch is the "CustomActionData". The return value for this will have the path you need.

So in your example, just change the name of the Set Property CA from "DeferredCustomActionName" to "addService".
In the script drop the line: MsiGetProperty(hMSI, "DeferredCustomActionName", svReturnValue, nvBuffer);
0 Kudos