[Closed] How to check when 3dsmax is closing?
Hi,
I’m having some troubles with my script, i need to run a code before 3ds max closes, is there any way to do this?
I was searching on the internet something, the closest thing that i could think to use in this situation was the following code:
fn domain_closing sender arg =
(
print "closing"
)
AppDomain = dotNetClass "System.AppDomain"
currentDomain = AppDomain.currentDomain
dotnet.addEventHandler currentDomain "ProcessExit " domain_closing
to be sincere i don’t even know exactly what is AppDomain , but looks that it have a event called before the process closes, but this code isn’t working, i can’t add the event using the dotnet.addEventHandler, please, can someone suggest an idea?
Thanks in advanced
there is a #preSystemShutdown callback you can use for this. I don’t think it will catch crashes or process kills though.
Thank you very much, i was looking for something like that for a long time, i don’t know how could i miss this on the help!
Just to complete the topic i will include a example of the code for anyone else that may need help.
global callback_beforeClose
fn callback_beforeClose =
(
messagebox "3ds max is closing"
)
callbacks.addScript #preSystemShutdown "callback_beforeClose()" id:#callback_beforeClose