This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: InstallScript function error
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 19, 2010
11:11 AM
InstallScript function error
I'm working on a Basic MSI project and have created an InstallScript function Custom Action. Here is the code for it
The error message pops up when I call ConfigAdd. I'm not sure why this is happening though, I've looked at the reference pages for the config functions and this should be right. What am I doing wrong?
I should also note the config file doesn't exist and is being created by this function.
if(ConfigFileLoad("C:\\Program Files\\myprogram\\config.properties") < 0) then
MessageBox ("Unable to load", SEVERE);
abort;
endif;
if(ConfigAdd("Workstation Name", "mycomputer", "", BEFORE) < 0) then
MessageBox("Unable to add", SEVERE);
abort;
endif;
if(ConfigFileSave("") < 0) then
MessageBox ("Unable to save", SEVERE);
abort;
endif;
The error message pops up when I call ConfigAdd. I'm not sure why this is happening though, I've looked at the reference pages for the config functions and this should be right. What am I doing wrong?
I should also note the config file doesn't exist and is being created by this function.
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 20, 2010
01:35 AM
Can you please give some more details like:
-Operating system
-Error message content
-custom action type and sequence
It could be a write permission issue since you try to write to C:\Program Files which is a UAC protected folder on Vista and later. If so you should read this document.
-Operating system
-Error message content
-custom action type and sequence
It could be a write permission issue since you try to write to C:\Program Files which is a UAC protected folder on Vista and later. If so you should read this document.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 20, 2010
11:34 AM
I'm using Windows XP Pro SP2.
I placed the custom action after "Write Ini Values" in the execution sequence, it's a deferred action and the execution schedule is set to "Always Execute". The MSI type is 66560.
The error message I get is the message statement I posted above in my code; that the config value couldn't be added and then the installation aborts. If I leave out this conditional check and abort call, the installation succeeds but the config file is never created in the directory I specified. I tried using the MSI Debugger tool, and in the execution script that's created my custom action is listed there.
I still have no idea why this isn't working. Does anybody know?
I placed the custom action after "Write Ini Values" in the execution sequence, it's a deferred action and the execution schedule is set to "Always Execute". The MSI type is 66560.
The error message I get is the message statement I posted above in my code; that the config value couldn't be added and then the installation aborts. If I leave out this conditional check and abort call, the installation succeeds but the config file is never created in the directory I specified. I tried using the MSI Debugger tool, and in the execution script that's created my custom action is listed there.
I still have no idea why this isn't working. Does anybody know?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 20, 2010
03:19 PM
What format is the file you are loading with ConfigFileLoad? The Config functions are expecting a text file formatted similar to an ini file (key=value pairs, basically). Errors updating the file with ConfigAdd are likely due to an unexpected format that can't be parsed by the Config functions.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 21, 2010
08:31 AM
The file hasn't been created yet, but according to what I've read, ConfigFileLoad should create the file if it doesn't exist, correct? It's a .properties file, and it will be in key=value pairs.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 25, 2010
12:51 PM
I'm still having this problem, anyone else have any ideas? This seems like a basic thing, and there is only 3 lines of code. I'm not sure where I'm going wrong.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 25, 2010
02:51 PM
It appears that the documentation is incorrect for ConfigFileLoad with reference to creating a new file. While ConfigFileLoad will succeed when passed the name of a file that does not exist, subsequent calls to functions such as ConfigAdd will then fail if the file did not exist. These functions have had this behavior since at least InstallShield Professional 7 (and likely earlier versions also).
I have submitted work order IOA-000053573 to have the documentation for ConfigFileLoad corrected.
To have the ConfigAdd call succeed, please ensure the filename passed to ConfigFileLoad exists (you can create an empty file if needed with CreateFile and CloseFile).
I have submitted work order IOA-000053573 to have the documentation for ConfigFileLoad corrected.
To have the ConfigAdd call succeed, please ensure the filename passed to ConfigFileLoad exists (you can create an empty file if needed with CreateFile and CloseFile).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 25, 2010
03:46 PM
okay, thanks a lot. i've been struggling over this and keep looking at the documentation and could not figure out what I was doing wrong.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)