OldStringCorona = "_Corona"
OldStringVRay = "_Vray"
OldStringScanline = "_Scanline"
NewString = ""
--fileName = getFilenameFile (maxFilename)
fileName = "sdd_Scanline"
if fileName != undefined and matchPattern fileName pattern:("*"+OldStringCorona+"*" OR "*"+OldStringVRay+"*" OR "*"+OldStringScanline+"*") ignoreCase:false == true then (
Newfilename = if fileName != undefined and matchPattern fileName pattern:("*"+OldStringCorona+"*") ignoreCase:false == true then (fileNameTemp = replace fileName (findstring fileName OldStringCorona) OldStringCorona.count NewString)
Newfilename = if fileName != undefined and matchPattern fileName pattern:("*"+OldStringVRay+"*") ignoreCase:false == true then (fileNameTemp = replace fileName (findstring fileName OldStringVRay) OldStringVRay.count NewString)
Newfilename = if fileName != undefined and matchPattern fileName pattern:("*"+OldStringScanline+"*") ignoreCase:false == true then (fileNameTemp = replace fileName (findstring fileName OldStringScanline) OldStringScanline.count NewString)
)
Newfilename1. I want this script to get the filename. Code not working above but just to gice you an idea where I'm at.
2. Remove either '_VRay' '_Corona' '_Scanline' from this to ''.
3. I tried StringStream Values in my first version but didn't get success.
Can it be used in this instance?
Link for StringStream http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/201…
My initial version was like:
TrimMe = stringstream "\"_VRay.max\\t_Corona.max\\t_Scanline.max\"" --notes \" Escape and \\t is the StringEscapes
seek TrimMe 0
readvalue TrimMe
max_file_name = getFilenameFile (trimright maxFilename TrimMe)But this trimright yielded unsuccessful results.
Any help would be grateful. Thanks.
By
Comments (4)
Comment policy
Regexpression Example
These 4 line of code do the exact same only better as long as you learn regular expressions:
turns on case insensitive
Matches a string with _Corona at the end
separates each match
Small bug in last code
NEW:
Added:
at the last case of to ensure matching strings where none of the first matchpatterns didn't exist.
using case of will solve this ....
I think that will give you an idea to do that, making it function will be good too.
Sorry For The Late Replay. Been busy elsewhere:
Here's the code now with some of the other code (The script rename objects to filename and based on object type) . Maybe the case of could do with a clean up, any suggestions?
Thanks very muchio :)