write to registry after apply install

Got a problem you cannot solve? Try here.
Post Reply
quintonmartin
Posts: 18
Joined: Wed Oct 17, 2007 4:44 pm
Location: Arizona, USA

write to registry after apply install

Post 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?
Robert
Posts: 18
Joined: Thu Jul 26, 2007 11:56 am

Post by Robert »

I would like to know how to do this as well.

Is there a way?

Thanks
quintonmartin
Posts: 18
Joined: Wed Oct 17, 2007 4:44 pm
Location: Arizona, USA

Post 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
Robert
Posts: 18
Joined: Thu Jul 26, 2007 11:56 am

Post 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.
Roostar2004
Posts: 155
Joined: Mon Nov 12, 2007 11:59 am

Post 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.
quintonmartin
Posts: 18
Joined: Wed Oct 17, 2007 4:44 pm
Location: Arizona, USA

Post 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
Roostar2004
Posts: 155
Joined: Mon Nov 12, 2007 11:59 am

Post by Roostar2004 »

I am not sure if the second apply effects the uninstall precess.
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post 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.
Jim Oswell
Software Engineering Manager, Dental
Greenway Health, LLC
http://greenwaymedical.com
Post Reply