Symbolic Pathnames

You can use symbolic pathnames in the form $<name> anywhere a filename can be supplied to MAXScript. This support has been added in 3ds Max 4 and largely enhanced in 3ds Max 9. Any filename you provide to MAXScript can begin with a '$' followed by one of the symbolic directory names below.

The following symbolic names are recognized:

Index

Symbolic Name

Directory

1

$max

Main 3ds Max executable directory

2

$maps

First directory in Maps directory config*

3

$scenes

3ds Max Scenes directory

4

$fonts

Fonts directory

5

$imports

File Imports directory

6

$exports

File Exports directory

7

$sounds

Sounds directory

8

$matlibs

Material Libraries directory

9

$scripts

Scripts directory

10

$startupScripts

Auto-load startup scripts directory

11

$plugins

First in the Plug-ins directory config*

12

$plugcfg

Plugin configurations directory

13

$images

Images directory

14

$ui

User Interface files directory

15

$macroScripts

macroScripts in UI directory

16

$web

Web downloads directory

17

$temp

System temp directory

18

$renderPresets

Render presets directory

19

$help

Help files directory

20

$expressions

Expressions directory

21

$previews

Previews directory

22

$maxstart

Directory of MAXSTART.MAX

23

$vpost

Video post directory

24

$drivers

Drivers directory

25

$autoback

Auto-backup directory

26

$marketDefaults

Market Defaults directory

27

$icons

Icons directory

28

$maxSysIcons

System icons directory

29

$renderOutput

Render output directory

30

$animation

Animations directory

31

$archives

Archives directory

32

$photometrics

Photometric files directory

33

$renderAssets

Render Assets directory

34

$userScripts

User Scripts directory

35

$userMacros

User Macroscripts directory

36

$userStartupScripts

User Startup Scripts directory

37

$userIcons

User Icons directory

38

$maxData

Max Data (Root) directory

39

$downloads

Downloads directory

40

$proxies

Bitmap Proxies directory

 

Please note that these are similar to the 3D Studio MAX System Directories filetype_names which start with a "#" and are used as arguments to the GetDir() and SetDir() methods.

The following example will open the file "foo.ms" in the current 3ds Max Scripts directory.

Example:

fileIn "$scripts\foo.ms"

 

new.gif NEW in 3ds Max 9: *The $maps and $plugins symbolic pathnames can also specify an index. In this case, the indexed directory will be used.

For example:

"$maps[2]\\mybitmap.tga"

When no index is provided, the first map resp. plugins path will be used.

 

SymbolicPaths Struct

new.gif NEW in 3ds Max 9: The SymbolicPaths struct provides methods to access existing and define new symbolic paths:

 

symbolicPaths.numPaths()

Returns the number of symbolic path names. This includes both system and user-defined path names

symbolicPaths.getPathName <index>

Returns the indexed symbolic path name.

Example:

for i = 1 to symbolicPaths.numPaths() do

format "% : %\n" i (symbolicPaths.getPathName i)

 

symbolicPaths.isPathName <string>

Returns true if the string corresponds to a symbolic path name, false otherwise.

Example:

symbolicPaths.isPathName "$maps"

true

symbolicPaths.isPathName "$map"

false

 

symbolicPaths.getPathValue {<index> | <string>}

Returns the path associated with the specified symbolic path name (specified either by index or by name string).

Example:

symbolicPaths.getPathValue 2

"C:\Program Files\Autodesk\3dsmax9\maps"

symbolicPaths.getPathValue "$maps"

"C:\Program Files\Autodesk\3dsmax9\maps"

 

symbolicPaths.numUserPaths()

Returns the number of user-defined symbolic path names.

symbolicPaths.getUserPathName <index>

Returns the indexed user-defined symbolic path name.

symbolicPaths.isUserPathName <string>

Returns true if the string corresponds to a user-defined symbolic path name, false otherwise.

symbolicPaths.getUserPathValue {<index> | <string>}

Returns the path associated with the specified user-defined symbolic path name

symbolicPaths.setUserPathValue {<index> | <string>} <filepath>

Sets path associated with the specified user-defined symbolic path name

symbolicPaths.addUserPath <string> <filepath>

Adds user-defined symbolic path name and path

symbolicPaths.removeUserPath {<index> | <string>}

Removes user-defined symbolic path name

symbolicPaths.expandFileName <filename>

Returns expanded file nane

ExampleS:

symbolicPaths.numUserPaths()--check for user path - none by default

0

symbolicPaths.addUserPath "$test" "c:\\test" --define new user path

OK

symbolicPaths.numUserPaths()--check for user path - there is one!

1

symbolicPaths.isUserPathName "$test" -- is a user symbolic path?

true

--See if $temp is a user symbolic path.

--NOTE that $temp is a SYSTEM symbolic path,

--but not a USER symbolic path:

symbolicPaths.isUserPathName "$temp"

false

symbolicPaths.getUserPathName 1 --get the name of the first path

"$test"

symbolicPaths.getUserPathValue 1 --get the first path

"c:\test"

symbolicPaths.getUserPathValue "$test" --get the path by name

"c:\test"

symbolicPaths.setUserPathValue "$test" "c:\\another\\path" --change

OK

symbolicPaths.getUserPathValue "$test" --see if it changeg?

"c:\another\path"

symbolicPaths.expandFileName "$test\\somefile.txt" --expand a path

"c:\another\path\somefile.txt"

symbolicPaths.removeUserPath "$test" --remove the user path

OK

symbolicPaths.numUserPaths()--there are no user paths left

0

See also

Zip-file Script Packages

3ds Max System Directories