find change

Oct 10, 2006 at 12:31pm

find change

Hi,

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”

#28064
Oct 10, 2006 at 10:36pm

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.

Repeat.

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.

#85752
Oct 19, 2006 at 1:17pm

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

Zeb

#85753
Oct 19, 2006 at 10:00pm

#85754
Oct 19, 2006 at 10:51pm

Joost wrote:
> 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
beginning…

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…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#85755
Oct 20, 2006 at 4:17am

#85756
Oct 20, 2006 at 3:45pm

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???

#85757
Oct 20, 2006 at 9:20pm

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|
http://www.dspaudio.com/ http://www.castine.de

#85758

You must be logged in to reply to this topic.