get xml/html files from the internet into a text-object

Matthias S.'s icon

hello,

i'm just working on a project where I need to download xml-files automatically.
already i've built a patch that works very well but i know it's not perfect.

the problem is that I can't figure out, how many lines there are in the jit.textfile. for my project I know, that I need exactly 88 lines, but if the file is smaller than that, it fills my max-window with error-messages. and if the number would be bigger, I just wouldn't get the data.

in my example you'll get these error-messages. does anyone have an idea how to solve this problem?

(I know there is way of handling that, when you just write the file to disk and then open it into the text-object, but i wonder if it would be possible to get a solution with my approach of doing it directly)

Max Patch
Copy patch and select New From Clipboard in Max.

thanks!
ms

Luke Hall's icon

Try this patch to send the file from [jit.textfile] into [text] which allows you to "query" the number of lines. At the moment you need to open and close the editing window or you get an error, I've experienced this problem before but no-one seems to know what causes it. You should only need to do the first time you download using [jit.uldl]. You might not even need the "query" part as [text] doesn't throw an error if the line you specify is out of range.

Max Patch
Copy patch and select New From Clipboard in Max.

lh