Notifications
Clear all

[Closed] Get 3DMAX installation path

Excuse me, how can I get all the installed 3DMAX installation paths in the computer through script in 3DMAX? Although I tried my best to think about it, the lack of technology made it impossible for me to continue.

2 Replies

you can do it using environment variables, but is skips some older max versions

(
	ev = (dotnetclass "system.environment").GetEnvironmentVariables()
	keys   = dotNetObject "system.string[]" ev.keys.count
	values = dotNetObject "system.string[]" ev.values.count

	ev.keys.copyTo keys 0
	ev.values.copyTo values 0

	installed_max_versions = for i = 0 to ev.values.count-1 collect
	(
		key = keys.get i
		val = values.get i
		
		if MatchPattern key pattern:"ADSK_3DSMAX_*" and (MatchPattern key pattern:"ADSK_3DSMAX_SDK*" == false) then #( key, val ) else dontCollect
	)

	print installed_max_versions
)

this one should work for 2009+

(

	installed_max_versions = for i = 1 to 30 collect
	(
		local val 
		local current_key
		local keys = #( "SOFTWARE\Autodesk\3DSMAX\\" + i as string + ".0\MAX-1:409", "SOFTWARE\Autodesk\3DSMAX\\" + i as string + ".0" )
		
		local success = false
		for k in keys while not success do
		(
			success = registry.openKey HKEY_LOCAL_MACHINE k accessRights:#readOnly key:&current_key
		)
		
		if success do registry.queryValue current_key "InstallDir" value:&val	
		if success and val != undefined then #( 1998 + i, val ) else dontCollect	
	)

	print installed_max_versions

)

Thanks for your help