[Closed] need help with script
i am trying to convert
c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png
to
c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png
i write this script
in this s= “c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png”
k=1
for j in 1 to s.count do
(
if(s[j] == “\”) then
(
a[k]=s[j]
a[k+1]=s[j]
k=k+2
)
else
(
a[k]=s[j]
k=k+1
)
)
this running half way
and showing this error
– Error occurred in anonymous codeblock; filename: ; position: 162; line: 17
– Runtime error: string index out of range
– MAXScript callstack:
– thread data: threadID:22688
– [stack level: 0]
– In j loop; filename: ; position: 141; line: 13
– Parameters:
– j: 63
– Locals:
– j: 63
– Externals:
– a: Global:a : “c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Check”
– s: Global:s : “c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png”
– k: Global:k : 69
– owner: undefined
– [stack level: 1]
– called from top-level
can any one help
and if you know any other way to do this
please reply
one way to do it :
src=@“c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png”
newPath = “”
for i in (filterString src “\”) do newPath += i+”\\”
src = "c:\Program Files\Autodesk\3ds Max 2017\maps\uvwunwrap\UV_Checker.png"
substituteString src @"\" @"\\"
-- same as
substituteString src "\\" "\\\\"