Notifications
Clear all

[Closed] Custom file extension in Maxscript

i have some MR render values which i can select through a dropdownlist…my question is, can i create a custom file extension (eg: *.patri) which is only accessible throught my script and use that in my dropdownlist??

8 Replies

It’s not quite clear to me what you mean exactly… You can of course name a file with any extension you want, and limit the file open dialog to that extension by adding the types parameter, like this:


fName = getOpenFileName types:"Patri file (*.patri)|*.patri|"

well i have some predefined values for mental ray…i want to create some preset files, for eg: MR1.patri, MR2.patri etc…and use those presets in a dropdownlist…the dropdownlist will have MR1 and MR2…so if i select MR1 from the dropdown it will select from the MR1.patri preset file inside a folder in 3dsmax…this is what i wanted to get…

there are lots of methods available to achieve what you want. you really should have a look at the maxscript documention, how to handle (read, write, parse…) files in the way that fits your purpose.

you might be interested in methods like openFile (or even encryptFile, openEncryptedFile), readLine, readDelimitedString, and all the other goodies that ‘FileStream Values’ has to offer.

Or, if you don’t wanna script your own parsing methods you could make the ‘MR1.patri’ as isolated scripts that set all the values and just have them encrypted. Then execute these scripts on demand. The file extension doesn’t really matter in the end…

you seem to have a lot of questions regarding maxscript, so instead of asking for all these steps i’d like to encourage you to try looking at the maxscript reference first – if you come to a dead end, we’ll still be here to help out

maybe like this:

-- preset_script.ms, name it whatever... MR1.patri, MR1.foobar... extension doesnt matter!
     (
       messagebox "foo"
       -- put your preset stuff here
     )
     
-- actual script
     (
       _preset = openFile "preset_script.ms" mode:"rt"
      execute _preset
     )
     
 again, use [i]encryptFile [/i]and [i]openEncryptedFile[/i] instead if you like. put the [i]execute <filestream>[/i] on an eventhandler then (i.e. dropdown or button or whatnot) - and, pressing [f1] in the script editor and searching for 'file' provided all the information needed. :p

you mentioned having the presets in the max folder… so here some information in advance:


symbolicPaths.getPathValue "$max"
--"C:\Program Files\Autodesk\3ds Max 2011"

yes blake…:)…i love MAXScript a lot…i just started using it few weeks ago…i cant stop working on it…i always refer to documentation and learned many things from it…but when it comes to advanced stuff like these i just cant find them…and honestly i really like the support am getting here…u guys have helped me a lot…

yeah, i didn’t mean to be rude or refuse help or something. just seeing you having so much fun with maxscript i wanted to make sure you know about the documentation

:eek::eek::eek:

:drool:[b]EUROPE[/b] and [b]AMERICA[/b] :drool:

both are my dream places...but i dont think i can get there...because here they dont care about freshers....no matter where we go they keep saying "you need experience"

just keep working on it, i’m sure there is always a way to achieve his own goals. on the other hand, afaik indias economy is growing bigtime these days. if you meet the right persons, you might have a bright future there as well