how to populate a menu from a .txt file?

synnys's icon

Is it possible to have a umenu or live.menu auto populate with 256 entries i get from a .txt file with 256 lines?

Ben Bracken's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Check out the [text] object. You can use the 'dump' message to output the contents, something like this:

nicnut's icon

Hi,
I am trying to populate a umenu with the items listed in a text file.

I looked at the patch in this post and still can't figure this out. Looks like it's using some Jitter objects

On my end it looks like the "text" object is an abstraction and doesn't have a help file. I'm on Max 8.2.1. Is the argument of the text object supposed to be the text file I want to load into the umenu? Because that's not working for me.

If I have a text file in the same folder as the patch I am using is there a way to populate a umenu with the text in the text file? I think there is but I can't figure it out.

thank you. Nick

Jean-Francois Charles's icon

The patch above is perfectly functional. It doesn't use any jitter object.
The [text] object is not an abstraction: if you Alt-click or Right-click, you can access the help file as any object.
The text file itself use in this example is called text_lyrics.txt. The patch works because the text file is part of the Max installation, so, Max finds it automatically.
To use your own text file instead of the 'text_lyrics.txt', use a 'read' message to the [text] object.

nicnut's icon

Hi Jean Francois.

Thanks for the reply. I think maybe something is missing or weird going on with my version of Max.
I am attaching photos of what the patch in this thread looks like in my version of Max, and what the inside of the object looks like.

On my computer the [text] object has no inlets and outlets, and looks like it's an abstraction. It also opens up a jit.window, which I thought was strange.

When I look inside the text object I see some jitter objects and I don't get a help file for this.

Maybe I should try and find where this abstraction is stored and delete it, or rename it. Let me know what you think.

thank you. Nick

this is what the inside of the text object looks in my version of Max

This is how the patch in this thread looks in my version of max

nicnut's icon

Hi again.

Ok, I had an abstraction named "text." I renamed it, so now I can see the text object. Hopefully I can figure this out.

Roman Thilenius's icon


for single lines [coll] is even better to handle than [text]... and offers some nice extra features when required.

and can be saved with the patcher for the initial umenu content.

and works across the runtime for multiple instances.

110.coll2umenu