How to get the Projectname - an other tips for my first MaxScript ( Max 2019 )
Hi!
I'm fighting to get my first Script done - i'll try to get some files from a source-folder and copy them into a new sub-folder within the actual projectfolder.
I'm not sure if it's the best-way to do this - but it actually works.
macroScript GetAssets category:"My Own Scripts" tooltip:"Get MAX, PSD and JPG Files" ( projectFolder = pathConfig.getCurrentProjectFolder() projectFolderAsString = projectFolder as string targetFolder = "\\_targetFolder\\" targetPath = projectFolderAsString + targetFolder testName = "FileXY.jpg" testFile = targetPath + testName if doesFileExist testFile then messageBox "Files are already there !!" else ( makeDir targetPath jpgList = getFiles "C:\\my-path-to-files\\*.jpg" for f in jpgList do ( file = f as string fileName = filenameFromPath file newFile = targetPath + fileName copyFile f newFile ) ) )
With this code i'm copying also *.max Files into my project - and here's the thing:
I'd like to add the name of the project as a prefix the max-files.
So i.e. the exterior.max should be renamed into MyProjectName exterior.max -> is there a way to strip this from my "projectFolderAsString" Variable ?
Is it also possible to merge CustomUserPaths from a MXP file into the actual projects MXP file ?
Thanks in advance :)
Robert