View Full Version : max version detection ?
xenry 02-22-2008, 08:41 AM Hi,
we make installer for some 3dsmax plugins
and we were wondering is there a way to
guess which version of 3dsMax (32bit-64bit)
is installed on this machine and where is its
install dir, by just reading the windows registry.
|
|
fferro2
02-22-2008, 12:38 PM
maxVersion()
GetDir #maxroot
ofer_z
02-22-2008, 02:03 PM
Hi,
The registry key for the installation dir is:
HKLM\SOFTWARE\Autodesk\3dsmax\8.0\Installdir
The 8.0 represents the max version. You have a different key for each installed version.
hOpe this helps,
o
decapitator
02-22-2008, 02:12 PM
Yes and 9.0 for r9 and 2008 is 10.0 But the 32/64 is more of a hardware thing so I wouldnt look up the install of max for it but just the system value somewhere..
mir-vadim
02-22-2008, 06:13 PM
is64bitApplication()
NEW in 3ds Max 9: Returns true if running in a 64 bit build of 3ds Max, false otherwise.
PiXeL_MoNKeY
02-22-2008, 06:22 PM
I think this is more of an SDK related thing than Maxscript. I am guessing the installer is a standard Windows installer/executable. So all the maxscript help is probably rather useless.
-Eric
xenry
02-22-2008, 06:26 PM
is64bitApplication()
NEW in 3ds Max 9: Returns true if running in a 64 bit build of 3ds Max, false otherwise.
well I need to recognize 32 from 64 bit max installation, before installing the plugin
RustyKnight
02-22-2008, 10:48 PM
I know it's probably not what you really want, but I'd suggest having seperate x32 and x64 installers.
As I recall, the "program files" environment variable will return a value based on the OS type AND the executable type.
That is, OS = 32, executable = 32, program files = "C:\Program Files"
OS = 64, executable = 32, program files = "C:\Program Files (x86)"
OS = 64, executable = 64, program files = "C:\Program Files"
So all you need to do after that is check which version of max is installed...
Shane
scorpion007
02-22-2008, 11:13 PM
What if max isn't installed in program files?
I'd suggest querying the registry keys, starting from the latest version you support going down, until you either find a match, or none exist, in which case provide a default path.
Look up RegQueryValueEx or perhaps RegEnumValue.
xenry
02-23-2008, 03:33 PM
thanks for the answers, we'll figure it out somehow
ZeBoxx2
02-24-2008, 05:18 AM
Your installer itself is likely to run in either 32bit or 64bit mode. Most installers also allow you to switch the registry to read from, however. E.g. NSIS via setRegView.
After that, as mentioned earlier, you'll need to read the installation location from the registry. Unfortunately, Kinetix/Discreet/ADSK haven't always been consistent. Here's the registry locations we use:
HKLM\SOFTWARE\Autodesk\3DSMAX\4.0\MAX-1:409\uninstallpath
HKLM\SOFTWARE\Autodesk\3DSMAX\5.0\MAX-1:409\uninstallpath
HKLM\SOFTWARE\Autodesk\3DSMAX\6.0\Installdir
HKLM\SOFTWARE\Autodesk\3DSMAX\7.0\Installdir
HKLM\SOFTWARE\Autodesk\3DSMAX\8.0\Installdir
HKLM\SOFTWARE\Autodesk\3DSMAX\9.0\MAX-1:409\Installdir
HKLM\SOFTWARE\Autodesk\3DSMAX\10.0\MAX-1:409\Installdir
That will only give you the main application installation folder, however. Ever since 3ds Max 9, there is also a user dir in e.g.
"c:\Documents and Settings\Username\Local Settings\Application Data\Autodesk\3dsmax\9 - 32bit\enu\"
However, I don't think there's any way to reliably get this folder location outside of max itself (within max, the paths API/maxscript should reveal it). You could try and make an assumption, but that 'enu' (english language) gets in the way and you'd have to detect for the other languages as well; I don't even know what strings they use :)
So installing for e.g. "current user" only is a bit problematic.
Depending on what you want to do, you may wish to write something that will install for all users a small plugin/script that, upon max startup, finishes completion to the correct user folders - if needed. If not needed, then the registry strings should be all you need.
scorpion007
02-24-2008, 07:38 AM
Just to further elaborate on what ZeBoxx said, you can query the local appdata path using SHGetFolderPath or SHGetSpecialFolderPath, with CSIDL_LOCAL_APPDATA as an argument.
While this doesn't give the precise location to max's storage area, it's a starting point, from which you can ask the user for the remainder, while providing a default response (for the eng version, perhaps).
ZeBoxx2
02-24-2008, 07:21 PM
you can ask the user for the remainder
That's actually part of the problem. "Local Settings" is a hidden folder by default; showing up only if the user has set up their Explorer preferences to show hidden files/folders, or by starting the browsing action with that folder as the initial folder.
Installing plugins for max is fun ;)
scorpion007
02-24-2008, 11:31 PM
Hmmm... perhaps the newer versions of max store the per-user path in the registry? Presumably in the HKCU hive. Might be worth checking.
ZeBoxx2
02-25-2008, 06:38 AM
Hmmm... perhaps the newer versions of max store the per-user path in the registry? Presumably in the HKCU hive. Might be worth checking.
Not that I have found, I'm afraid. There are several 3ds Max(-related) entries in HKCU.
The main one is:
HKEY_CURRENT_USER\Software\Autodesk\3DSMAX\10.0
Unfortunately, however, none of its subkeys contain any information with regards to the user path.
The other entries are related to the FLI/FLC file format and that sort of thing.
A quick search for "9 - 32bit\enu" in the entire registry actually fails to result in any hit.
I might have missed something, but there's certainly nothing even in the SDK help file with regards to writing plugin installers and the user folder.
So.. writing a plugin or script that would continue installation upon 3ds Max startup (obviously, for plugins, that would require a 3ds Max restart after 'installation', unless your plugin is hot-loadable) might be the best route after doing a well-educated guess using the information available (i.e. local_appdata + known strings for 32bit/64bit + enu).
Just to note, though - this only applies if you really, really want to write to the user folders for some reason. E.g. if you have an absolute need or desire to install plugins only for the current user, or want to pre-write a config file (PlugCfg) only for the current user, etc. In the many years of 3ds Max use and poking at plugins, I have yet to find one that actually installed for the current user only; at best, a "Current User" installation would make Start Menu shortcuts only show up for that user, but the plugin would still be installed for All Users. It's not a big deal, imho - it is, however, a curiosity and it does semi-prevent doing clean 'current user' installs if you do want to do them.
CGTalk Moderation
02-25-2008, 06:38 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.