MAXScript Tools and Interaction with 3ds Max > File Access > 3ds Max Scene Files Access >

# MAX Scene File Properties

The File Properties can be accessed in MAXScript using the methods described in this topic.

The File Properties are organized into three sets. These sets correspond to the three pages in the Main Menu > File > File Properties dialog:

    #summary

This set contains the Title, Subject, Author, Keywords, Comments fields from the Summary page.

    #contents

This set contains the Manager, Company, Category and an array of all headers from the Contents page like General, Mesh Totals etc. Note that the Contents page contents are only update when the file is saved. You can perform a max hold to perform a scene hold, which causes the file to be saved and the Contents page contents to be updated.

    #custom

This set contains all the fields from the Custom page.

The following methods are used to access the above sets. <set_name> can be any of the values from above.

    fileProperties.getNumProperties <set_name>

Returns the number of properties in the given set.

FOR EXAMPLE:
    numProps=fileProperties.getNumProperties #summary

    fileProperties.getPropertyName <set_name> <index>

Returns as a string the property name of the given index. The index is 1-based.

FOR EXAMPLE:
    nameProp=fileProperties.getPropertyName #summary 1

    fileProperties.getPropertyValue <set_name> <index>

Returns the property value of given index. The value type can be one of the following types of values currently supported by 3ds Max in the File Properties dialog. The values in bracket are the MAXScript equivalent value type.

Property Value Types:

    Text [String]
    Date [String] - contains the date eg:"03/23/99"
    Number [Integer or Float based on actual value]
    Yes or No [Boolean]
    Headers [Array of strings]

Headers are items like General, Mesh Totals, etc. that appear in contents page.

FOR EXAMPLE:
an array of headers from contents page obtained using:
    fileproperties.getPropertyValue #contents 1
will return
    #("General", "Mesh Totals",...)

    fileProperties.getItems <header_string>

Returns an array of strings containing all the items under the given header.

FOR EXAMPLE:
an array of headers from contents page obtained using:
    fileProperties.getItems "Mesh Totals"
might return
    #("Vertices: 488", "Faces: 968")

    fileProperties.findProperty <set_name> <prop_name_string>

Given the set name and property name string, will return the index of the property if found, 0 if not found.

FOR EXAMPLE:
    fileProperties.findProperty #custom "BoolVal"

    fileProperties.addProperty <set_name> <prop_name_string> <prop_value> [#date]

Adds a new property with the property name and property value to the specified set.

The property values can be any of the types previously described except an Array as you cannot add anything to contents page.

If string containing a date is passed then the optional #date argument has to be passed for it to be added as a date value.

Adding to an existing property name will replace the existing value and act as a setter function - this is why there is no fileProperties.setProperty() method.

FOR EXAMPLE:
    fileProperties.addProperty #custom "DateVal" "03/23/99" #date
will add a date property named DateVal to the custom page.

    fileProperties.deleteProperty <set_name> <prop_name_string>

Delete the property indicated by <prop_name_string> in the specified set.

Following is an example of printing all the File Properties in an hierarchical fashion for the current scene.

EXAMPLE:
     -- Add some properties
    fileProperties.addProperty #summary "Title" "H2G2"
    fileProperties.addProperty #summary "Subject" "Earth"
    fileProperties.addProperty #summary "Author" "Ford Prefect"

    fileProperties.addProperty #contents "Manager" "Zarniwoop"
    fileProperties.addProperty #contents "Company" "Megadodo Publishing"
    fileProperties.addProperty #contents "Category" "Mostly Harmless"

    fileProperties.addProperty #custom "IntVal" 42
    fileProperties.addProperty #custom "FloatVal" 1.234
    fileProperties.addProperty #custom "BoolVal" true
    fileProperties.addProperty #custom "DateVal" "05/11/2001" #date
    -- -- Perform a scene hold to update the Contents set.
    max hold
    -- -- Get all properties
    pages = #( #summary, #contents, #custom)
    for pg in pages do
    (
    format "--- % ---\n" (pg as string)
    for i=1 to (fileProperties.getNumProperties pg) do
    (
    local pname = (fileProperties.getPropertyName pg i)
    local pval = (fileProperties.getPropertyValue pg i)
    format "\t% : " pname
    if (pname =="Headers") then
    (
    format "\n"
    for hdr in pval do
    (
    format "\t\t%\n" hdr
    local docs = fileProperties.getItems hdr
    if docs != undefined then
    for d in docs do format "\t\t\t%\n"d
    )
    )
    else format " %\n" pval
    )
    )

#### See Also

- 3ds Max File Loading and Saving

- External File Methods

- File Name Parsing

- Standard Open and Save File Dialogs

- Exiting and Resetting 3ds Max

- Accessing INI File Keys