PDA

View Full Version : OnMoved called twice



ebo2002fr
08-18-2005, 08:43 AM
Hi,

I am launching a custom action after OnMoved execution. My action xcopies a dll from a directory to another. But, OnMoved is executed twice in the install sequence. The first time occurs before webapp files are moved to the target. So, the action fails because it does not find the dll on the target filesystem.

I need to launch my custom action at the end of one of two features I am installing. How can I do that ?

Thanks.

Eric

bhagelin
08-18-2005, 11:59 AM
You could include in the script some logic that checks the directory that you move the DLL to, to see if it exists. If it does exist then skip code that moves the DLL, as that action has already taken place.

ebo2002fr
08-19-2005, 03:19 AM
You could include in the script some logic that checks the directory that you move the DLL to, to see if it exists. If it does exist then skip code that moves the DLL, as that action has already taken place.

Good idea.

I found also in the help that Feature Event Handler OnInstalled can be used. In InstallShield 11 langage reference, it is written :

"To create an event handler function for a feature, select the feature name from the left event-category list, and select the event you want from the right event list. "

I cannot find it. I am using Installshield 11 Professional Edition.

Regards.

Eric

MarcusM
08-19-2005, 04:42 AM
I also didn't find it. I then just wrote a function, named it accordingly and selectedit in the dropdownbox with the respective feature at OnInstalled. But the functon itself can be named any way you like - you just have to export it when you declare the function. Only exported functions show in the drop down list.

Marcus

ebo2002fr
08-19-2005, 05:55 AM
I then just wrote a function, named it accordingly and selectedit in the dropdownbox with the respective feature at OnInstalled. But the functon itself can be named any way you like - you just have to export it when you declare the function. Only exported functions show in the drop down list.

Marcus

Hi marcus,

Where is this dropdownbox ? In one of "setup.rul" dropdownlists (screen "InstallScript") ? In the first dropdownlist, I have : "Before Move Data", "Move Data" and "After Move Data". In the second one, I have only "begin".
In which screen do you put the feature at OnInstalled ?

Thanks.

Eric

MarcusM
08-19-2005, 06:18 AM
Sorry, I wasn't clear enough. The function is written in a rule file of your choice (ok, the rule file has to be part of your project, of course ;)) and has to be exported: export prototype YourFunctionName
After that you have to go to the feature selection dialog and select the feaature you want the function to be called by. In the feature's options you can find 4 events: OnInstalling, OnInstalled, OnUnnstalling and OnUninstalled. If you click in the field on the right to an event you get a drop down list which shows all functions you have declared as "export".

I have attached a screenshot to demonstrate this. The function in the example was declared thus:
export prototype Funk_OnInstalled();

I usually go by the naming convention Featurename_Eventname() to make it clear that this specific function is called by a certain feature.

I hope this made it a little clearer ;)

Marcus

ebo2002fr
08-19-2005, 07:19 AM
Thanks Marcus. It's clear now :)

I know now why I did not see "OnInstalled" in feature dropdownlist. I am using a Web project, not an InstallScript project. The 4 events are not available for web projects :(. So, I have to find another way to do the post-install action.

Regards.

Eric