is it possible to: read text from a text file test.txt every second and only print the part that’s added to the textfile in this second. So when de text in the textfile is: "hello world" it print’s "hello world". When I change the text to "hello world goodbye world" then it prints only what’s added so: "goodbye world"
One possible solution – the js object:
Read in the file, output the entire content, save the file-end position in a js variable. Retain the opened file reference (ie don’t call the file object’s close() method.
One second later (via js Task in the js object itself, or external metro bang or whatever), go to stored position, output from there to end of file, store new end of file.
Not closing the file might cause "file in use" problems if you try to edit it externally, if so, you’ll need to open/close the file in the js each time. In any case, make sure you close the file before quitting.
okay, sounds easy but i don’t know how to work with js in MAX/MSP yet…i’m a MAX/MSP newbie so can you help me out a bit more??
How can i save the end of the line??
Hope someone can help me with this!!
Thanks in advance
> is it possible to: read text from a text file test.txt every second
> and only print the part that’s added to the textfile in this second.
> So when de text in the textfile is: "hello world" it print’s "hello
> world". When I change the text to "hello world goodbye world" then it
> prints only what’s added so: "goodbye world"
Sure its possible, but what should happen if something within the text
changes? This might be tricky. Its probably better done in a procedural
language like js or java. But you could read it in, and compare letter
by letter and output only differences…
If you assume only text is added, you just need to count and cut off the
What is the size of the text: big or always smaller than lets say 256
words? If the latter you could do all with the zl object…
Just some ideas…
the textfile never changes there are only words added to the textfile. it tried the zl objects and the did do what i wanted but as you said my text is too long..
what can i use instead???
shell object with tail?
On 20-Oct-2006, at 17:45, Joost wrote:
> the textfile never changes there are only words added to the
> textfile. it tried the zl objects and the did do what i wanted but
> as you said my text is too long..
> what can i use instead???
————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|