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
- :
- Install dir set by a registry key
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
‎Apr 24, 2008
01:02 PM
Install dir set by a registry key
Hello to everyone
i'm new on this board.
I'm trying Installshield 2008.
I need to make an installer for patching an installed program.
I choosed an installscipt project for creating the patching exe.
Well my wish is that my installscript project will detect if a certain registry key is in the end user registry and if it is present to detect the program folder installation path from that registry and finally to install the upgrade bu using the path detected in the registry key.
I looked into the installshield help library and i found the function called:
RegDBKeyExist ( szSubKey );
that will return a value 0 or 1 if the directory exist or not.
Well how can i code the installscript to check if a registry exist and if exist to use the installpath specified in the registry key as the path of the INSTALLDIR? :confused:
i hope you'll solve my question.
Thanks a lot in advance
Cheers
Ordine
i'm new on this board.
I'm trying Installshield 2008.
I need to make an installer for patching an installed program.
I choosed an installscipt project for creating the patching exe.
Well my wish is that my installscript project will detect if a certain registry key is in the end user registry and if it is present to detect the program folder installation path from that registry and finally to install the upgrade bu using the path detected in the registry key.
I looked into the installshield help library and i found the function called:
RegDBKeyExist ( szSubKey );
that will return a value 0 or 1 if the directory exist or not.
Well how can i code the installscript to check if a registry exist and if exist to use the installpath specified in the registry key as the path of the INSTALLDIR? :confused:
i hope you'll solve my question.
Thanks a lot in advance
Cheers
Ordine
(17) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 24, 2008
04:22 PM
If it's an InstallScript project, perhaps use RegDBSetDefaultRoot and RegDBGetKeyValueEx to read the registry path, and then (if it exists) set TARGETDIR to the value you read?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2008
05:46 PM
Thnaks a lot for your suggestions.
Can you write down a little piece of code where insttascript ooks for a reg key and set the path specified into it as the default TARGETDIR?
Thnaks in advance for all your help and suggestions.
do i have to specify all theese function in ON Begin section?or where?
Cheers
Can you write down a little piece of code where insttascript ooks for a reg key and set the path specified into it as the default TARGETDIR?
Thnaks in advance for all your help and suggestions.
do i have to specify all theese function in ON Begin section?or where?
Cheers
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2008
06:58 PM
OKy i tried a little bit by myself.
I used a function to state which is the registry root i want to use and then another function to check if the registry key exist and if not exist the installer runs out here i sthe code.
Now i have to use the function called "RegDBGetKeyValueEx" to read the value stored in the subkey called "Patch2" in HKEY_CURRENT_USER//JimPhoenix and to set that value as TARGETDIR.
so the function syntax is:
RegDBGetKeyValueEx ( szKey, szName, nvType, svValue, nvSize );
Now how can i specify the key and the subkey and moreover how can i retrieve the valeu and set it to TARGETDIR?
i tried so but without any succcess:
Wehere did i make the mistake?
Please help me.
Thanks a lot
Cheers
I used a function to state which is the registry root i want to use and then another function to check if the registry key exist and if not exist the installer runs out here i sthe code.
// Set the interested reg root
RegDBSetDefaultRoot ( HKEY_CURRENT_USER );
// Set the reg key interested for checkin' if exists
szKeyRoot = "JimPhoenix" ;
// If it exists the process will go on , if doesn't exist installer stops
if (RegDBKeyExist (szKeyRoot) < 0) then
MessageBox ("JimPhoenix non è installato sul computer. Si prega di installare il gioco prima di procedere all'installazione della patch.", SEVERE);
abort;
else
MessageBox ("JimPhoenix è stato rilevato sul computer", INFORMATION);
endif;
Now i have to use the function called "RegDBGetKeyValueEx" to read the value stored in the subkey called "Patch2" in HKEY_CURRENT_USER//JimPhoenix and to set that value as TARGETDIR.
so the function syntax is:
RegDBGetKeyValueEx ( szKey, szName, nvType, svValue, nvSize );
Now how can i specify the key and the subkey and moreover how can i retrieve the valeu and set it to TARGETDIR?
i tried so but without any succcess:
szKey = szKeyRoot;
szName = "Path2" ;
RegDBGetKeyValueEx ( szKey, szName, nvType, svValue, nvSize );
svValue = TARGETDIR;
Wehere did i make the mistake?
Please help me.
Thanks a lot
Cheers
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2008
07:04 PM
Please see the help topic "RegDBGetKeyValueEx Example" for some additional code; toward the end, you'll want to use TARGETDIR=svValue; instead of the other way around....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2008
07:28 PM
I set in this way:
But i receive this compiling error:
C:\InstallShield 2008 Projects\altraProva\Script Files\Setup.Rul(65) : error C8046: '1' : numeric variable required
Line 65 is the line where there is this : RegDBGetKeyValueEx (szKey, szName, nType, svValue, nSize );
I lokk deeply in the examples as you suggested me but i don't really understand which is the problem.
Can you help me please?
Thanks a lot
szKey = "JimPhoenix";
szName = "Path2" ;
nType = REGDB_STRING;
RegDBGetKeyValueEx (szKey, szName, nType, svValue, nSize );
svValue = TARGETDIR ;
But i receive this compiling error:
C:\InstallShield 2008 Projects\altraProva\Script Files\Setup.Rul(65) : error C8046: '1' : numeric variable required
Line 65 is the line where there is this : RegDBGetKeyValueEx (szKey, szName, nType, svValue, nSize );
I lokk deeply in the examples as you suggested me but i don't really understand which is the problem.
Can you help me please?
Thanks a lot
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 28, 2008
07:39 PM
Uhmm noiw it compiles but the path stored in the registry key is not taken as a whole.
I mean the patch in store in the key is "C:\Program Files\JimPhoneix"
But the installshiled only takes the first part that is to say : "C:\"
Infact all the files are extracted inside "C:\" instead of "C:\Program Files\JimPhoneix"
Why?
I mean the patch in store in the key is "C:\Program Files\JimPhoneix"
But the installshiled only takes the first part that is to say : "C:\"
Infact all the files are extracted inside "C:\" instead of "C:\Program Files\JimPhoneix"
Why?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
09:38 AM
Does it work if you switch the order to: TARGETDIR=svValue; instead of the other way around?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
11:08 AM
I am having similar isssues.
I have a function that goes out and reads a key but I want to check to see if the subkey is there. What am I missing, all the examples in the library are for MSI projects and not Installscript (only) projects.
I have a function that goes out and reads a key but I want to check to see if the subkey is there. What am I missing, all the examples in the library are for MSI projects and not Installscript (only) projects.
#include "Ifx.h"
prototype CheckRequirements();
function CheckRequirements()
NUMBER nReturn;
NUMBER nControl;
STRING svRegKey;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
svRegKey = "SOFTWARE\\Microsoft\\.NETFramework\\v.2.0.50727";
if (RegDBKeyExist(svRegKey) < 0) then
MessageBox(svRegKey + "\n\n Does Not Exist",SEVERE);
else
SprintfBox(INFORMATION,"Key Exists","%s",svRegKey);
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
11:13 AM
That code you posted should work; you'll just need to call your CheckRequirements function from OnBegin or OnAppSearch in order for it to take effect...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
11:56 AM
Thank you for your help, I went back and verified the key and I had an extra . in it.
I have another post about Installscript logging, would you mind taking a look at it.
http://community.macrovision.com/showthread.php?p=414776#post414776
I have another post about Installscript logging, would you mind taking a look at it.
http://community.macrovision.com/showthread.php?p=414776#post414776
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
01:45 PM
New Registry problem. I am trying to read a string value and it keeps telling me it is installed even if I change the value that it is checking for. Here is an example. The red line is the incorrect value it should be "Service Pack 2" but using as an example. This returns it is installed and of course Service Pack 21 is not. Where am I messing this up at.
NUMBER nType, nSize, nvType, nvSize;
STRING svRegKey,szName,szValue,svValue;
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
svRegKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
szName = "CSDVersion";
szValue = "Service Pack 21";
nvType = REGDB_STRING;
if (RegDBGetKeyValueEx (svRegKey, szName, nvType, szValue,nvSize) < 0) then
MessageBox("MISSING: Windows 2003 SP2",SEVERE);
else
MessageBox("INSTALLED: Windows 2003 SP2",INFORMATION);
endif;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
02:01 PM
(Please start a new thread if there's a new question...)
With RegDBGetKeyValueEx, the only input is the subkey and value you're reading; the last three values are filled in by the function. If I understand the question, perhaps compare szValue to the string you want to test for?
With RegDBGetKeyValueEx, the only input is the subkey and value you're reading; the last three values are filled in by the function. If I understand the question, perhaps compare szValue to the string you want to test for?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 29, 2008
02:17 PM
Ok, I understand now, I have changed my code to this and it works the way i want.
Thank you for your help! 🙂
svRegKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
szName = "CSDVersion";
szValue = "Service Pack 2";
RegDBGetKeyValueEx (svRegKey, szName, nvType, svValue,nvSize);
if (szValue != svValue) then
Thank you for your help! 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 30, 2008
02:56 PM
RobertDickau wrote:
Does it work if you switch the order to: TARGETDIR=svValue; instead of the other way around?
In order to check if the registry key was taken as a whole i decided for debuggin to script a little more for appering a window showing the taken registry value.
So i decided to do in this way:
function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
string szName, szCompany, szTargetPath, szKey, szKeyRoot, szDir, svValue, szFeatures;
NUMBER nvType, nvSize;
BOOL bLicenseAccepted;
begin
nSetupType = COMPLETE;
// Set the default key root
RegDBSetDefaultRoot ( HKEY_CURRENT_USER );
// Set the reg key to look for
szKeyRoot = "JImPhoenix" ;
// If the application exists it continues, if not it closes the install process
if (RegDBKeyExist (szKeyRoot) < 0) then
MessageBox ("Jim Phoenix was not detected on your pc. We recommend to install the application before applying this patch.", SEVERE);
abort;
else
MessageBox ("Jim Phoenix was detected on your pc", INFORMATION);
endif;
// It Takes the registry key value from the reg key
szKey = "JimPhoenix";
szName = "Path2" ;
nvType = REGDB_STRING;
//nSize = -1;
RegDBGetKeyValueEx (szKey, szName, nvType, svValue, nSize );
// Show a message with the registry key value
szTitle = "Test path";
szMsg = svValue;
SprintfBox (INFORMATION, szTitle, szMsg, svValue);
So i trusted that the registry key value was taken completely.
Then i decided to set that key value as TRGET DIR and here i found some troubles that i solved specifying theese following code lines:
TARGETDIR = svValue;
szDir = TARGETDIR;
TARGETDIR = svValue;
I don't know why specifiying TARGETDIR = SvValue twice it works...while specifying only one time it didn't work 😞
The last idea was to allow the end user to select the correct installation folder ( even if it is useless ) and to set as default location in the Dlg_SetupType2 the path inside the reg key.
So id ecided to set in this way
szTargetPath = svValue;
szTargetPath = TARGETDIR;
Is everything correct or is there something more elegant to do?
Thanks a lot for your great help, patience and kindness
Cheers
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 30, 2008
04:18 PM
I am trying to figure out how to create a string value named InstallPath for my application.
this is created by the installer but want to add a string value and name to it
HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME\PRODUCTNAME
Name = InstallPath
Type = STRING
Descript = TARGETDIR
this is created by the installer but want to add a string value and name to it
HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME\PRODUCTNAME
Name = InstallPath
Type = STRING
Descript = TARGETDIR
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2008
02:47 PM
For an InstallScript project, can you use the graphical registry view to set that value to (where InstallScript expands that expression to the value of TARGETDIR)?
Either that, or perhaps look into calling RegDBSetDefaultRoot and RegDBSetKeyValueEx from script.
Either that, or perhaps look into calling RegDBSetDefaultRoot and RegDBSetKeyValueEx from script.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 02, 2008
03:13 PM
Thank you that worked 🙂