PDA

View Full Version : Help: Maxscript for Find/Replace in .bat file


slooper
11-11-2003, 05:57 PM
I would like to take a .bat file and have a maxscript that goes through the entire file and replaces all the back slashes "\" with forward slashes "/"

Does anyone know if this is possible, and how?

Thanks!

Sean Looper

slooper
11-11-2003, 06:45 PM
actually, if it's easier (and cleaner) all I really need is a function that takes a string and replaces the f-slashes with b-slashes. Kinda like this:

s = "dav/id"
r = s.count
for i = 1 to r do
(
if s[r] == "/" then
(
s = replace s r 1 "\\"
)
)
print s

this should return "dav\id" an I right? But it doesn't. Can someone please tell me what I might be doing wrong?

Sean

slooper
11-11-2003, 06:48 PM
ok nevermind lol I answered my own question...

this line:

s = replace s r 1 "\\"

should read:

s = replace s i 1 "\\"

and this line:

if s[r] == "/" then

should read:

if s[i] == "/" then


Glad I could share this learning experience with you all! ;)

Sean

CGTalk Moderation
01-16-2006, 04:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.