<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Find and Replace in a txt file (xml file)</title>
		<atom:link href="http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 07:13:10 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-25744</guid>
					<title><![CDATA[Find and Replace in a txt file (xml file)]]></title>
					<link>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-25744</link>
					<pubDate>Tue, 02 May 2006 12:25:00 +0000</pubDate>
					<dc:creator>spierala</dc:creator>

					<description>
						<![CDATA[
						<p>Hi!</p>
<p>I?m new to max and javascript as well&#8230; </p>
<p>Is it possible with javascript to read a textfile and change there a certain string in a certain line?<br />
I looked at the jsfiletester example. So I know how to read and write a file.<br />
But how can I load the content of the txt file to a variable?</p>
<p>The best would be a find and replace object ;-)</p>
<p>cheers Flo</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-76150</guid>
					<title><![CDATA[Re: Find and Replace in a txt file (xml file)]]></title>
					<link>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-76150</link>
					<pubDate>Wed, 03 May 2006 22:42:35 +0000</pubDate>
					<dc:creator>spierala</dc:creator>

					<description>
						<![CDATA[
						<p>ok so far I am:</p>
<p>function writefile(s)<br />
{<br />
	var f = new File(s,&#8221;write&#8221;,&#8221;TEXT&#8221;); <br />
	var s1 = &#8216;test&#8217;;<br />
	var s2 = &#8216;this&#8217;;<br />
	var s3 = &#8216;text&#8217;;</p>
<p>	if (f.isopen) {<br />
		post(&#8220;writing string to file: &#8221; + s2 + &#8220;n&#8221;);<br />
		f.writestring(s1); <br />
		f.writestring(s2); <br />
		f.writestring(s3); <br />
		f.close();<br />
	} else {<br />
		post(&#8220;could not create file: &#8221; + s + &#8220;n&#8221;);<br />
	}<br />
}</p>
<p>i want to write an XML file. i have already the content of it. so i just have to paste it into the variables. but not so easy as expected&#8230;<br />
if i paste the XML file to the variable JS has problems with the newlines and shift rights in the XML&#8230;<br />
I attached the XML file which is basically a MOTION2 file. So you can try to paste it to one of the variables&#8230;<br />
I also tried to get away with the newlines of the XML in the text editor but it won?t help. <br />
I still get some error code like this: <br />
? error: js: jsfiletester.js: Javascript SyntaxError: unterminated string literal, line 26<br />
 source line: lurSamples><motionblurduration>1</motionblurduration></p>
<p>
cheers FLO</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-76151</guid>
					<title><![CDATA[Re: Find and Replace in a txt file (xml file)]]></title>
					<link>http://cycling74.com/forums/topic/find-and-replace-in-a-txt-file-xml-file/#post-76151</link>
					<pubDate>Thu, 04 May 2006 22:04:18 +0000</pubDate>
					<dc:creator>spierala</dc:creator>

					<description>
						<![CDATA[
						<p>sorry for the aweful selftalk topic ;-) but&#8230;<br />
hey I?m very proud to present the find and replace script:</p>
<p>function rwlines(r,w,clip)<br />
{<br />
	var r = new File(r);<br />
	var i,a,c;<br />
	var w = new File(w,&#8221;write&#8221;,&#8221;TEXT&#8221;); <br />
	var s;<br />
	var clip;<br />
	var neu;</p>
<p>	if (r.isopen){<br />
		post(clip);<br />
		i=0;<br />
		while (a=r.readline()) { // returns a string<br />
			post(&#8220;line[" + i + "]: &#8221; + a + &#8220;n&#8221;);<br />
			i++;<br />
			if (a.search(/clip02.mov+/) != -1)       <br />
			{neu = a.replace(/clip02.mov/, clip);<br />
            w.writestring(neu + &#8220;n&#8221;);}<br />
            else<br />
            {w.writestring(a + &#8220;n&#8221;);}<br />
		}<br />
		r.close();<br />
		w.close();<br />
	} else {<br />
		post(&#8220;could not open file: &#8221; + s + &#8220;n&#8221;);<br />
	}<br />
}</p>
<p>the only thing I don?t know yet, is how to save the new file in a certain folder&#8230;<br />
cheers FLO</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

