[Closed] PLEASE HELP! Get maxFileName first 5 digits or letters
hello I am trying to get a maxFileName but i only want the first 5 digits of the file name so i can save out a fbx with that file name and also minus the .max at the end
this is what i got so far (sorry i am new at this so i know my code sucks)
max select all
sel = selection as array
fileName = maxFileName
folder = @“E:\su_files\FBX EXPORT\” –your path
ext=”.fbx” –your extension
exportFile (folder+fileName+ext) #noPrompt selectedonly: true
(
max select all
-- sel = selection as array
fileName = getFilenameFile maxFileName
folder = @"E:\su_files\FBX EXPORT\" --your path
ext=".fbx" --your extension
exportFile (folder+fileName+ext) #noPrompt selectedonly: true
)
What do you mean by “but i only want the first 5 digits of the file name”? Can you give an example of “file name”?
wow thanks a lot for replying so quick sorry agian to pm you
its
saving it like
01_0092_00_Thumbnail_Zelcova Serrata ‘Green Vase’_100_0007.fbx
but i want
01_0092_00.fbx
(
max select all
-- sel = selection as array
fileName = substring (getFilenameFile maxFileName) 1 10
folder = @"E:\su_files\FBX EXPORT\" --your path
ext=".fbx" --your extension
exportFile (folder+fileName+ext) #noPrompt selectedonly: true
)
If you need the first 5 characters of the file name use this:
fileName = substring (getFilenameFile maxFileName) 1 5
OMG you are a legend
can you pm me your paypal address
I can give you a little something for the help when this project is done next week
also i know i am asking a lot but how can i get it to save into its own folder with the 10 digit file name?
What have to be the name of the “own folder”? The same as the name of the file(10 digits name)?
Try this:
(
max select all
fileName = substring (getFilenameFile maxFileName) 1 10
fullFolderPath = @"E:\su_files\FBX EXPORT\" + fileName + "\\"
if doesFileExist fullFolderPath == false do
(
makeDir (@"E:\su_files\FBX EXPORT\" + fileName + "\\")
)
ext=".fbx"
exportFile (fullFolderPath+fileName+ext) #noPrompt selectedonly:true
)
OMG perfect thanks
really really thanks for the help
don’t forget to pm your paypal