cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Flexera beginner

OnInstalledFile - need example help

INSTALLSCRIPT PROJECT
So I want to manipulate a file once it is installed; updates, etc don't need the manipulation so it seems OnInstalledFile event handler is the way to go. I must be having a bad day because I can't figure out how to code this. I added the event handle to my rul file.

the szFile parameter - the file I want to manipulate is: \company\product\abc.config

So do I put FOLDER_COMMON_APP\\company\\product\\abc.config in place of szFile? since we install to both 32 and 64 bit systems we rely a lot on the predefined variables for install locations.
Labels (1)
0 Kudos
6 Replies
Highlighted
Pilgrim

Re: OnInstalledFile - need example help

szFile = FOLDER_COMMON_APP ^"company\\product\\abc.config"

should set the correct value
0 Kudos
Highlighted
Flexera beginner

next step

I understand that I can set a string to the path/file name, but where do I set the string, and then what?

Since its an event, I don't actually "call" OnInstallFile.

This is added to my rul:
OnInstallFile(myfilename)
begin
end;

I want to do different things for 4 different files. Do I add 4 OnInstallFile events? How do I differentiate each one? How do each get 'called'?

Thanks. Sorry to be dense on this topic.....
0 Kudos
Highlighted
Pilgrim

Re: OnInstalledFile - need example help

You have to use the feature events.
After you have added your files to a feature you can select the feature in the right frame of your InstallScript (yello mark), Select your feature, then select in the box right the "Installed" property. IS generates a Function which is called when the feature was installed.
0 Kudos
Highlighted
Flexera beginner

Re: OnInstalledFile - need example help

understand and have used feature_installed events before.

so you are saying I need to start with a feature_installed event for the feature that contains the component that contains the specific file I want to trigger the action.

I set szFile inside the feature_installed()? then 'call'
OnInstalledFile(myfileString)? Where do I put the code for what I want to happen after that file is installed? inside OnInstalledFile() do I have a switch statement for each file I want activity to be triggered off of?
0 Kudos
Highlighted
Pilgrim

Re: OnInstalledFile - need example help

just put all files you want to overwrite and change in one feature, after the files are installed the Component_Installed() function is called automatically and you can change all files.

You can also make a feature for every file you want to change and edit them in FilleX_Installed() but I don't recommend that.
0 Kudos
Highlighted
Flexera beginner

OnInstalledFile()

I looking to understand how to use OnInstalledFile(), not Component_installed().

The "overwrite" parameter on the components that contain the files will dictate if any of the files I will need to edit are installed. Only if the file is installed do I need to edit it. Not if the component is installed, if that file in the component is installed. Let's say a component has 12 files and the update parameter is set to "newer version". For my next release 3 of the 12 files have been updated and now have newer versions. When I run the installer, only those 3 files will be put on the client system because the other 9 do not have a newer version. I only need to edit 1 of the 3 to insert specific information from the registry into the file. Therefore I want to use OnFileInstalled() for the one file I need to edit. There is another file that I edited at installation time, but since it does not have a newer version it will not be installed and therefore I do not need to re-edit it.

Thanks.
0 Kudos