[Closed] Maxscript – Good place to save ini? and permissions?
Hi all
I have a script that lets the user choose a bunch of settings. I then want to store that in an ini file (the easy part).
The question is, where’s a good place to then store that ini file for reading later?
I was thinking inside the root of max or perhaps in scripts in the root? How would I handle permissions for it then?
Any advice or suggestions?
I suggest using the language neutral version, otherwise the settings are not shared between sessions in different languages ( thats true for Max 2013 and above)
getdir #plugcfg_ln
do you think that the same user working in different languages has a trouble because he uses different plugin settings between sessions? AM is English, and PM is French…
he has much more troubles just working in different languages
Thanks guys. I’m still learning Maxscript so could you give me a little more info please?
What do I do with this?
getdir #plugcfg_ln
If the user has windows UAC then don’t save in the program files folder, you’ll have to go in the user directories instead, which is also then set per user rather than per machine which might be more what you want anyway.
This will give you the path to the folder where to save the ini file.
But, as Dave said, is better to use the user directories.
For me that path does refer to the 3dsmax folder inside the user directory, is it not always the case?
You are right. I did not check where it points. I thought it is at 3dsMax install directory.
It only points into the 3ds Max install folder if the user has the “useUserProfiles=0” tweak active in “Installsettings.ini”. Otherwise ( the default is “useUserProfiles=1” ), it points into the user folder, like the other paths…
in my experience the saving settings per user works better than per machine.
but for some tools i have a ‘common’ settings. i save it in my tool actual directory. usually this file is created by me and ‘read only’. but some advanced (delegated) users can overwrite these settings to define preferred (or default) settings for their team. it’s used with a tool’s method ~“Reset”
Your tool has to be universal.
We use a shared map for scripts, that is – more computers can use the same scripts together. This saves a lot of time for installing, especially when I modify them little by little, I do not have to install them again and again. When I reinstall windows/max, I just have to point to the same path and I don’t need to install all the scripts again.
But, every user(computer) has it’s own settings.
That’s why:
If you modify the paths for
Customize/System Paths/
1 Additional Scripts
2 Additional Macros
3 Additional Icons
to the common shared path with scripts, then you can place your scripts there.
Settings. If you want to have different settings for your scripts, then you may choose between
- (getdir #scripts) + “\my_map_settings” –“C:\Program Files…”
- (getdir #plugcfg) + “\my_map_settings” – but in this case, you should not modify the path for “Hardware Shared Cache” to the common path
PS: getdir #plugcfg_ln is not universal, not all of today max versions know about it.
If you put this common folder to dropbox, google drive, or even on an usual flash drive then you will have your scripts with you, wherever you go.
Max version from Max 2013 and up know it. I would’nt call Max 2012 a today’s Max version to be honest. Anyways… It’s quite easy to write a little function to check the version and return either #plugcfg_ln or #plugcfg respectively
What do you think about #vpost?
It seems to be neutral. It will never interfere with common shared path for scripts, and it would not require permissions if you have UAC.
it’s a video post directory.
it sounds like you want to put your tool settings safely away. let me suggest the #Photometric e.g. (i’ve never used it. honestly i did’t know that it exists)
settings_path = if 1998+((maxversion())[1]/1000)>2012 then (getdir #plugcfg_ln) else (getdir #plugcfg)
here is it.