[Closed] Help finding 3dsMax default installation and Bit version
Hello! Maybe you guys can help me out…
So I need to write a script that finds the default 3dsMax installation (The 3dsmax version that is used when opening a max file from explorer) and I need to know whether it’s 32bit or 64 bit.
In order to find the exe I checked the DefaultIcon path in the registry that .max files use.
So now that I have the path to the 3dsMax.exe, I need to know if that installation is 64 bit or 32bit.
I found this in the reference:
is64bitApplication()
But it only checks if the 3dsMax version you are running at the moment is 64bit or not.
Do you guys have any idea how I can find out if a certain 3dsMax installation is 32bit or 64bit?
This is by no means a watertight method, and assumes that on a 64-bit machine you would install 32-bit max in program files x86 and 64-bit max in program files, but you could try to test if:
systemTools.getEnvVariable "programfiles(x86)"!=undefined
that way you know if you are on a 64-bit system or a 32-bit system.
Another not amazing option:
((dotnetclass "system.diagnostics.process").getcurrentProcess()).MainModule.filename
you can check if the current running version of max is the executable you found, and assume that if is64bitapplication() returns true then it is 64-bit max, and if not then it is 32-bit max.
Of course, this would not be certain if you had more than 2 executables of max installed (for example, two verisons of 3dsmax each in 32-bit and 64-bit)
There are more options but you have to resort to c#.net.
I’ll see if I can put something up, as I have made a tool that figures this problem out automatically.
-Johan
what methods would use to get the bit type of an EXE without running it as a process?
after googling “c# get file associations” and poking around i found this nice dll at codeproject
download the dll and then getting the path to the 3dsmax.exe which opens by default is easy:
dotnet.loadAssembly @"X:\my path to the dll\AF_FileAssociations.dll"
a = dotnetobject "Associations.AF_FileAssociator" ".max"
a.Executable.Path -- returns the path to 3dsmax.exe
-- note that the path string has an extra set of quotes "" in the string
so you'll need to use substring or filterstring to get a useable path.
EDIT: In case anyone saw it, I was wrong about the first result on google. Not sure how I got to the linked page above. The solution works regardless
(
max32file = (getDir #maxroot) + "max32.task"
max64file = (getDir #maxroot) + "max64.task"
if ((getfiles max32file).count != 0) then
(
messageBox "You're running a 32-bit version of Max" beep:false
)
if ((getfiles max64file).count != 0) then
(
messageBox "You're running a 64-bit version of Max" beep:false
)
-- format "
Max32 %
Max64 %" max32file max64file
)
Of course, it wouldn’t be fullproof if for some reason the files got moved around, but as long as the installation was normally, that might work for you.
how is this what you’re looking for? Doesn’t it just return whether or not the currently running max is 64-bit or 32-bit?
How is it different than is64bitapplication() ?
well, (getDir #maxroot), gives you the full path to the 3dsMax root folder, doesn’t it?
So I assume that I could replace that with any other 3dsMax root folder in my PC. To be honest I haven’t really tried it out yet, since I’m stuck on a 32 bit machine at the moment.
There should be no difference between:
max32file = (getDir #maxroot) + "max32.task"
and
max32file = "C:\\Program Files\\Autodesk\\3ds Max 2011\\" + "max32.task"
right? :curious:
On a 64-bit Windows install, the 32 bit path would contain (x86) in its name (by default), and the 64-bit path would not have “(x86)” in its file path name.
Either way, we just use “getDir #maxroot” to get the correct directory, no matter where Max is installed. Much, much better than hard-coding file paths.
Getting the path to the 3dsMax root folder is not a problem in my case, whether it’s 32bit or 64bit. I essentially get a list of 3dsMax.exe path’s from somewhere else. And I need maxscript to figure out if they are 32 or 64 bit.
And checking whether max32.task exists or not, I can determine if it’s a 32 bit or 64 bit installation.
Thanks again