Change Project Folder automatically if present

Submitted by:Tim Kelly

Date added:25 June, 2011

Category:Maxscript

When placed in startup scripts, this snippet activates every time user opens a file. It then traverses the directory path backwards and looks for user created project folders. If one is found, script offers to switch it on.

This is very useful when working with a number of projects at a time.

Tags: change folder

Code Snippet:

callbacks.addScript #filePostOpen "phTraverseProjectPath()" id:("phTraverseProjectPath" as name)

fn phTraverseProjectPath = (

curPath = maxFilePath
queryAnswer = false

for i = 1 to 15 do (
if curPath == "" do continue;
if pathConfig.isProjectFolder curPath then (
if (pathConfig.getCurrentProjectFolder() != curPath) do (
if (queryAnswer == false) do (
if (queryBox ("Change Project Folder?\n" + (curPath as String))) do (
pathConfig.setCurrentProjectFolder curPath
)
queryAnswer = true
)
)
)
curPath = pathConfig.removePathLeaf curPath
)

)
 
 

Comments