Notifications
Clear all

[Closed] A few basic script questions…

Hi.

If you want to trim the full path:

"C:\Projects\project\models\props_dev\dev_test.x"

to:

"props_dev\dev_test.x"

You’ll have to specify what the base path is. In this case would be:

"C:\Projects\project\models\\"

So you can write a function like this one:

fn trimPath basePath fullPath = (
	if (findString fullPath basePath) != undefined do (
		return ( substring fullPath (basePath.count + 1) (fullPath.count - basePath.count) )
	)
	return undefined
)

And make use of it like this:

basePath = "C:\Projects\project\models\\"
fullPath = "C:\Projects\project\models\props_dev\dev_test.x"
trimPath basePath fullPath

That will return the relative path:

"props_dev\dev_test.x"

Hope it helps.

Thanks – got it working now.

max8 supports an “initialdir” property when calling getsavepath(). Unfortunately this doesn’t port over to max7. I’d like to setup starting directorys for each of the inputs…is this doable in max7?

Page 2 / 2