For a number of tasks, such as installation units, it is necessary to determine the way, where MoBu is installed. The register in Windows can help us to deal with it.

For a 32 bit application, check the installation in the registry:

HKEY_LOCAL_MACHINE \ Software \ Autodesk \ MotionBuilder \ + “version of the MoBu”

for the version of the MoBu use can specify 2009, 2010, 2011, 2012, 2013.

Get the path itself you can with variable “InstallPath” within the key above.

For 64-bit applications it will be in the same way to the registry, but the 64 bit version of register.

Here is the code of functions for Inno Setup 5:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function MoBu_Path32(Param: String): String;
var
key, path: String;
begin
key := 'Software\Autodesk\MotionBuilder\' + Param;
Result := '';
if RegKeyExists(HKEY_LOCAL_MACHINE, key) then
begin
If RegQueryStringValue(HKEY_LOCAL_MACHINE, key, 'InstallPath', path) then
begin
Result := path;
end;
end;
end;

function MoBu_Path64(Param: String): String;
var
key, path: String;
begin
key := 'Software\Autodesk\MotionBuilder\' + Param;
Result := '';
if IsWin64 and RegKeyExists(HKLM64, key) then
begin
If RegQueryStringValue(HKLM64, key, 'InstallPath', path) then
begin
Result := path;
end;
end;
end;

function IsMoBu(Param: String): Boolean;
begin
Result := False;
if RegKeyExists(HKLM, 'Software\Autodesk\MotionBuilder\' + Param) then
begin
Result := True;
end;
end;

function IsMoBu64(Param: String) : Boolean;
begin
Result := False;
if IsWin64 and RegKeyExists(HKLM64, 'Software\Autodesk\MotionBuilder\' + Param) then
begin
Result := True;
end;
end;
Extract the MoBu’s installation path from the register
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *