PDA

View Full Version : Installation Path


AHRIMANSEFID
08-25-2008, 06:20 AM
Hi
I want to set an installation path for my exe file. But I need to do this:
Before running installation I want the installer to check an adress in the registery which has installed before, so the installation shuold executed in the path that registery path specified.
Can anyone help me? Thanks.

Ulrich
08-25-2008, 09:12 AM
This is easy. Before you show any further screens, fetch the current location of your product (if the key exists in the registry), and set the %AppFolder% session variable accordingly.

In this example, I will install something in the same folder where SUF 8.0 is installed. This code is located in the On Next handler of the Welcome to Setup screen.


if (Registry.DoesKeyExist(HKEY_CLASSES_ROOT, "Applications\\SUF80Design.exe")) then
-- fetch the current installation location at the proper place
program = Registry.GetValue(HKEY_CLASSES_ROOT, "Applications\\SUF80Design.exe\\shell\\open\\comman d", "", true)
-- other operations
path = String.Mid(program, 2, String.ReverseFind(program, "\\", false) - 1);
-- set the destination folder
SessionVar.Set("%AppFolder%", path);
end
-- advance to the next screen (with AppFolder properly set)
Screen.Next();


Ulrich

AHRIMANSEFID
08-26-2008, 01:12 AM
Excuse me, I think you miss underestood me.
I want to search for this registery address: e.g.:
[HKEY_CURRENT_USER\Software\MySoft\FSX]
"FSXPath"="E:\\Program Files\\MySoft\\Valid ADDress\\"
If the address was correct, the installation path must be in this address, Im doing this because the user may have changed the path of the primary program, and I want the additional program installed correctlly without needing the user to specify the path.
Thanks.

Ulrich
08-26-2008, 08:09 AM
My former post indeed answers your question. Try to understand what I wrote and the simple example, but this is no copy-and-paste solution. Realize that, after you have the installation folder correctly set in %AppFolder%, you probably want to supress the Select Install Folder screen to prevent further modification.

Ulrich

AHRIMANSEFID
08-27-2008, 01:57 AM
Thank you
But me Need Serach And Find (.exe) Me Need Serch Reg And Find Address.
Thank You.