Forums > MaxMSP

find change


Oct 10 2006 | 12:31 pm

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"

Oct 10 2006 | 10:36 pm

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.

Oct 19 2006 | 1:17 pm

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

Oct 19 2006 | 10:00 pm

Oct 19 2006 | 10:51 pm

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

Oct 20 2006 | 4:17 am

Oct 20 2006 | 3:45 pm

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

Oct 20 2006 | 9:20 pm

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

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP