View in #3ds_max on Slack
@TooL: anyone know if there is a os env var for finding the appdata folder for a max install?
I know for the actual max install folder I can do os.environ.get("ADSK_3DSMAX_x64_{}".format(version))
but I’ve just run into an outsourcer that my script hasn’t copied our startup script correctly, which I’m assuming as I was expecting to put it in ENU
but they probably are on Chinese or something…Trying to see if there are reasonable ways to check what languages they might have installed/use etc
I assume I could just brute check for what folders are there in ask where to setup stuff to, but it’d be good if there was a more “concrete” way to do it
@instinct-vfx: localization is the bane of my max existence.
Well…one of the banes…but still
it got to a point where i had over 80 plugin.inis on my system (many max versions to support + many languages automatically made available)
Using Max in german is giving me goosebumps of hate.
@TooL: haha. Yeah I’ve been lucky so far and have dodged the loc bullet till now…
no idea how, but managed it
@Frieder_Erdmann: oh shit, we make that same assumption of ENU
being the goto thing
can you see from the process what flag its run with? /Language=DEU
@TooL: I’m not sure tbh. This setup script is full outside of max running at all (if I could get the language it might be worth making it copy stuff while max is running)
@Frieder_Erdmann: Computer\HKEY_CURRENT_USER\SOFTWARE\Autodesk\3dsMax\21.0
CurrentLanguage
so your setup could check what language it’s set to and then run from there
I present to you:
internal_versions = dict([(str(year), str(year-1998) + ".0") for year in range(2015, 2035)])
@TooL: lemme give that the ole try
ah, good ole registry checking…I have not missed you…
I guess 23.0 must be 2021?
@Frieder_Erdmann: yeah
that’s the 1998 magic number
@TooL: lol…that makes a lot more sense…
@Frieder_Erdmann:
import os
import sys
if sys.version_info > (3, 0):
import winreg as winreg
else:
import _winreg as winreg
version = "2019"
version_folder = "{} - 64bit".format(version)
internal_versions = dict([(str(year), "{}.0".format(year-1998))
for year in range(2015, 2035)])
language = "ENU"
languages = ["ENU", "FRA", "DEU", "CHS", "KOR", "JPN", "PTB"]
hkcu = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
language_key = "SOFTWARE\\Autodesk\\3dsMax\\"
language_key += internal_versions[version]
print(language_key)
try:
setting_key = winreg.OpenKey(hkcu, language_key)
settings = winreg.QueryValueEx(setting_key, "CurrentLanguage")
for value in settings:
if str(value) in languages:
language = str(value)
except WindowsError:
pass
max_startup_dir = os.path.join(
os.environ.get("LOCALAPPDATA"),
"Autodesk", "3dsMax",
version_folder, language,
"scripts", "startup")
if not os.path.exists(max_startup_dir):
os.makedirs(max_startup_dir)
i hate the magic needed in this
like - 64bit
or +".0"
but it seems like it should be pretty safe after that