Notifications
Clear all

[Closed] xml Ouput

hello all i’m looking for a script that would output a list of all the object under the xml format.
In other word i have a template XML and i wish to fill the hole with the name of the scene object like

 <body listname="Scene_object" >
 			  <object name="object01"/>
 			   <object name="object02"/>
 		  </body>
 

so if someone already made a script like this or have an idea of where to start i would be very thankful to know it .
im sorry if this look like a way of asking for someone else to do it but i dont have much time at work and i need it as soon as possible. Plus i’m not the more advanced user of maxscript thus i’m asking for help.

thank all
edit; while searching Max innard i found the xmlIO by ravi karra(discreet) .helpful but way to complicated for what i’m looking for.
still searching. Btw i already look at scriptspot…

4 Replies

Here’s a script that will out put the formatted information to a file named “SceneObjects.xml” on your c:\ drive. Edit the first line as necessary to change the filename or put it elsewhere.

ssXML = createFile "c:\\SceneObjects.xml"
 
 if ssXML != undefined then (
    format "<body listname =\"SceneObject\" >
" to:ssXML
   
    for obj in objects do (
       format "	<object name=\"%\"/>
" obj.name to:ssXML
    )
 
    format "</body>" to:ssXML
 
    close ssXML
 )

wow fast and clean ! thank a lot !

just a question .
what the
\r mean? i think
mean its an output? but what mean the other? or at least under wich section can i found info in the help?

1 Reply
(@jeff_hanna)
Joined: 10 months ago

Posts: 0

They’re escape characters used inside of strings (text within double quotes)

  • newline
    \r – return

    • tab
      \ –
      ” – “

The last one is a bit confusing. But, if you don’t escape a quote you want in the string then MaxScript will interpret it as the end of the string instead.

“And then Jeff said, “this is incorrect.”” <– this won’t work like you expect
“And then Jeff said, “this is correct.”” <— this will work properly.