
jaishankar.vurimi1.552492209090264E12 asked a question.
Could not get the INSTALLDIR value using the Deferred custom action.
Hi,
- I wanted to delete all the application created files in the installed path after uninstallation.
- To acheive this i was trying to get the INSTALLDIR value through deferred custom action as per the below link.
http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm
- My Configurations:
1. Create a set-a-property custom action (type 51) called GetINSTALLDIR
Property Name: DisplayINSTALLDIR
Property Value: [INSTALLDIR]
Install Exec Sequence: After InstallInitialize
2. In the InstallScript view, create a new function called DisplayINSTALLDIR with the below code.
export prototype DisplayINSTALLDIR(HWND);
function DisplayINSTALLDIR(hISWI)
STRING szInstDir;
NUMBER nvCount;
begin
nvCount = MAX_PATH;
if (MsiGetProperty(hISWI,"CustomActionData",szInstDir,nvCount) = ERROR_SUCCESS) then
SprintfBox(INFORMATION,"Deferred Execution","The value of INSTALLDIR is %s",szInstDir);
SprintfBox(INFORMATION,"Deferred Execution","The value of InstallScript's INSTALLDIR is %s",INSTALLDIR);
endif;
end;
3. In the Custom Actions and Sequences view, created an InstallScript custom action called DisplayINSTALLDIR.
Function Name: DisplayINSTALLDIR
In-Script Execution: Deferred Execution in System Context
Install Exec Sequence: After GetINSTALLDIR
My Output:
The values of szInstDir & INSTALLDIR in the above 2 message boxes are blank.
Other Observation:
When tried the same as instructed in the link (http://helpnet.flexerasoftware.com/installshield18helplib/AccessingProps-DeferredCAs.htm ) i am getting a blank message for the first messagebox & a code for the 2nd message box.
Could you please guide me.
I cannot open your sample in InstallShield 2012. Can you please provide an example that works in InstallShield 2012?MSIDeferredCATest2012
If the buffer size is not the issue, you may want to try creating a verbose log of the installation to see if any custom action data is passed to the custom action that needs it. For example, running the attached sample yields the following log entry when the deferred action is run:
"
MSI (s) (F8:9C) [16:39:29:802]: Executing op: CustomActionSchedule(Action=DisplayINSTALLDIR,ActionType=3073,Source=BinaryData,Target=f1,CustomActionData=C:\Program Files (x86)\My InstallDir\)
"
Notice the CustomActionData value is displayed in the log for the action that was scheduled to run. This would allow for verifying the custom action data is being set up correctly by the earlier set property action.
I am new to installshield, I do have a similar issue where in the install script which was migrated from 10.5 to 12 is not able to get the value for INSTALLDIR(I did add a few debug prints and found that this value isn't coming through in IS 2012). This script works perfectly fine when built on installshield 10.5 but when the same was ported to installshield 12, the value for INSTALLDIR doesn't seem to be populated. Any idea what would be missing.....
Thanks in Advance....
Arun J
http://blog.deploymentengineering.com/2006/06/installscript-meet-customactiondata.html