Page 1 of 1
write to registry after apply install
Posted: Thu Jan 17, 2008 12:01 pm
by quintonmartin
I need to update the registry, but I don't know the value until after the "apply install". Has someone already written a plugin or know of another way that I can write a registry value bypassing the windows installer?
Posted: Thu Feb 21, 2008 6:41 pm
by Robert
I would like to know how to do this as well.
Is there a way?
Thanks
Posted: Mon Feb 25, 2008 4:18 pm
by quintonmartin
Hi Robert,
The solution I finally came up with was to use a VBScript program to update the registry. Here's how I did it.
Drag and Drop "Run Program" item from the right side of the screen to the point in your script after the "apply install" command.
Run Program Dialog fields:
Run Program: $winsysdir$\\cscript.exe
Hide program window: Checked
Command Line Parameters: //Nologo $SUPPORTDIR$\\UPDATEREG.VBS $DATAPATH$
Wait for program to finish: Not checked
Return result in variable: blank
Then I created a text file called updatereg.vbs and plased it in my support files. It looks like this:
Dim WshShell, KV, Desc, oArgs
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oArgs = WScript.Arguments
if oArgs.Count <> 1 Then Wscript.Echo "Syntax: cscript //nologo UpdateReg.vbs ""c:\\myapp\\data"""
if oArgs.Count <> 1 Then Wscript.Quit
Desc = oArgs(0)
KV = "HKLM\\SOFTWARE\\ODBC\\ODBC.INI\\Myapp\\DataDirectory"
WshShell.RegWrite KV, Desc, "REG_SZ"
It works for me. The VBS code was copied for the most part from another post I found here. I really don't know vbs.
Quinton
Posted: Mon Feb 25, 2008 4:30 pm
by Robert
Thanks,
I was hoping I didn't have to write an app to write one key.
I was thinking that what I have to do.
Posted: Tue Feb 26, 2008 8:38 am
by Roostar2004
You should not have to write an app to write a registry key. I have used installaware's "write registry key" command and it works fine for me.
If you have the write registry key after the apply install I think that you need to place another "apply changes" command after this is completed. Other then that just use the registry key creator that installaware provides.
What kind of data are you looking to write here. You said it had to be done after the install.
Posted: Tue Feb 26, 2008 10:15 am
by quintonmartin
I was under the impression that a second apply in the install would prevent the uninstall from completely removing all of the files installed by the first "apply install". I thought I read that in one of these messageboard threads, but maybe that is not true?
After my software is installed, the user uses one of those programs to attach to a database. I then, based on the database they choose, need to possibly apply some updates, then update the ODBC driver with the path to the database that they choose. Prior to the install, I don't have all the tools installed to properly determine that a valid database path is choosen. So, I do these steps...
Install my programs
Apply install.
Run database connection utility I just installed, which determines database path.
update database if necessary
update registry with valid database information
Posted: Wed Feb 27, 2008 12:44 pm
by Roostar2004
I am not sure if the second apply effects the uninstall precess.
Posted: Wed Feb 27, 2008 5:16 pm
by jimo
1. The second apply install will mess with uninstalling the product
2. A simple solutino to this would be to use the file bag to bundle a temporary copy of your database utility run it before the apply install to get your registry value and update the reg key before apply install.