filterString a maxFilePath

Hi there, I'm wondering how I'm able to get a part of the maxFilePath. I'm trying to separate the path but filterString doesn't allow me to use the "\".

I'm trying to get "Vorm Ontwikkeling bv" from the path underneath:
"Z:\Vorm Ontwikkeling bv\20627 - De Laverie te Oosterhout\03 Max\Scenes\Standpunten\VV 01\VV01_031.max"

function getFolderName = (
local sceneName = maxFilePath + maxFileName
local theName = filterString sceneName[4] "/"
local stringFolder = (theName[1])
return theName
)

Hoping for some help :)

Thank you.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Why you not remove the last 3 characters from the end result?

(
	filePath = @"Z:\Vorm Ontwikkeling bv\20627 - De Laverie te Oosterhout\03 Max\Scenes\Standpunten\VV 01\VV01_031.max"
	fStr = filterString filePath "\\"
	fstr2 = filterString fStr[2] " "
 
	theName = ""
	for i = 1 to fstr2.count - 1 do
	(
		theName += fstr2[i] + " "
	)
	format "theName: % \n" theName
)
remykonings's picture

*

instead of the filePath: "Z:\Vorm Ontwikkeling bv\20627 - De Laverie te Oosterhout\03 Max\Scenes\Standpunten\VV 01\VV01_031.max"

can I use: "maxFilePath + maxFileName" as well?

When I try that, I'm getting different results.

miauu's picture

.

I have a Z drive and I tested with maxFilePath + maxFileName. The code that I posted works and the end result is the same for the provided path. Watch this:
https://drive.google.com/file/d/1DSTS86_ZKOOvovGOr4tQm3RZBLksvy1_/view?u...

jahman's picture

.

what if you do it like this?

filterString string "\\"
remykonings's picture

*

That seems to work I think, though I'm not getting the right result.

the sceneName = "Z:\Vorm Ontwikkeling bv\20627 - De Laverie te Oosterhout\03 Max\Scenes\Modellen\Omgeving\Omgeving_062.max"

function getFolderName = (
local sceneName = maxFilePath + maxFileName
local theName = (filterString sceneName "\\")
local stringFolder = (theName[2]) as string
return stringFolder
)

As a result I'm hoping to get is: "Vorm Ontwikkeling"

I probably need to add something to the stringFolder argument?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.