Changing INI settings post system shutdown?

KasperFilipsen
Enthusiast

Changing INI settings post system shutdown?

KasperFilipsen
Enthusiast
Enthusiast

I have created a startup script that uses callbacks to change my ENU settings to what I prefer.

I've looked through the system callbacks, and the latest callback, from what I can see is postSystemShutdown, which is what I'm trying to use whenever changing INI files.


The problem is, some of the INI files get overwritten by Max when it shuts down. So even if I change them during postSystemShutdown, they just get overwritten.

E.g. the SME.ini file, which is located in the plugcfg_ln folder.

 

Is there somekind of workaround or solution to this problem?

I'd very much prefer to be able to just have it be a part of my startup script, rather than having to fix it myself manually outside of max.

0 Likes
Reply
220 Views
4 Replies
Replies (4)

miauuuu
Collaborator
Collaborator

Use your script to run a python, or powershell or batch file which will set the desired INI settings(or directly will replace the INI files).

 

I have a script which uses the #postSystemShutdown callback to run a powershell file. In the powershell file I have a loop which checks every 5 sec(10 iterations) if 3dsmax.exe is still open. When the 3dsmax.exe no longer exist as a process the PS script does what I want(not related with INI files).

https://miauu-maxscript.com/
0 Likes

KasperFilipsen
Enthusiast
Enthusiast

I guess that's one way of doing it.

I had hoped there would be a way to use maxscript, since it's easy to use the max system paths, instead of having to get those yourself and having to figure out what version of max you are even using.

 

Another dumber method was pointed out by a friend of mine, which works if you don't change the settings often.
Open max, run the script to change the INI files and then crash max. Then it wont update the files.

0 Likes

miauuuu
Collaborator
Collaborator

You can put the .py/.ps1/.bat files in the same location where are the INI files you want to change. Use the #postSystemShutdown callback to run the an .ms file. This way you can get all system paths inside 3ds max, you can find the desired .py/.ps1/.bat files and you can run them. Instead of checking if 3dsMax.exe is still active process you can set the .py/.ps1/.bat to start executing its code with a delay, for example 5 min. So, when you close 3ds max it will overwrite the INI files and 5 min later your .py/.ps1/.bat will overwrite the INI files again.

The .py/.ps1/.bat can get the proper INI files easily because they will check only the INI files which are in the same folder where .py/.ps1/.bat are located.

Also, you can create .py/.ps1/.bat dynamically inside your .ms file, so you can change any parameters you want before 3ds max to get closed.

https://miauu-maxscript.com/
0 Likes

denisT.MaxDoctor
Advisor
Advisor

A better solution would be to have your own INI file, separate from the system INI file, and use its values to override the system values when the system boots.

 

0 Likes