Chaos Corona Forum

General Category => General CG Discussion => Topic started by: aaouviz on 2023-10-12, 15:03:26

Title: Help with Max scripting
Post by: aaouviz on 2023-10-12, 15:03:26
Man, I suck at maxscript...

I want to make a simple "Save and then Exit" script (via toolbar button).

This is what I have, but I can't quite get it to work as intended. Any helpers out there? Many thanks!

Code: [Select]
--Original script by: aaouviz
------

macroscript SaveAndExit
category: "AAScripts"
buttonText: "Save and Exit"
tooltip: "Save and Exit"
Icon:#("AAGen_01",1)


(
saveMaxFile
)
quitmax #noprompt
Title: Re: Help with scripting
Post by: James Vella on 2023-10-12, 15:32:07
I assume you just want File > Save correct? Overwrite previous version?

Code: [Select]
--Original script by: aaouviz
------

macroscript SaveAndExit
category: "AAScripts"
buttonText: "Save and Exit"
tooltip: "Save and Exit"
Icon:#("AAGen_01",1)
(
        max file save
quitmax #noprompt
)
Title: Re: Help with Max scripting
Post by: aaouviz on 2023-10-12, 20:39:34
Amazing, and perfect as always James.

Thanks a million!
Title: Re: Help with Max scripting
Post by: James Vella on 2023-10-12, 21:47:25
Glad to hear its working as expected :)
Title: Re: Help with Max scripting
Post by: Frood on 2024-01-11, 09:17:53
Hi,

picked up the idea but implemented it as file menu item. Additionally, saving only happens if a save is required (no changed made to scene, relying on getSaveRequired()). Script goes to any autostart folder (usually scripts\startup). Sharing it as an alternate option.


Good Luck



Title: Re: Help with Max scripting
Post by: aaouviz on 2024-01-11, 10:48:00
Excellent!

The 'saving only happens if a save is required' seemed a bit beyond my capabilities, so I didn't bother. But this is clever of you, and I feel pleased to have I've influenced you, Frood :)
Title: Re: Help with Max scripting
Post by: Frood on 2024-01-11, 13:21:42
Yes, thanks for letting me steal that idea to use them for myself - which is my daily deed ;)


Good Luck