Forums > MaxMSP

mxj net.local to a umenu

February 28, 2010 | 7:33 pm

Hi

Retrieving my ipaddress via mxj net.local but I don’t like the way it works in the example help file with the umenus. Once populated, even through the first one looks like it is selected you have to click and release on it to put it into effect.

I’m only interested in getting en1 so I’m doing this

loadbang
|
en1
|
mxj net.local

and that spits out:
clear, append 111.111.1.11, append fe80:0:0:0:217:f2ff:fee7:98f5%6

how do I tell when the mxj net.local is finished outputting or count the output so I can bang the umenu to actually use the first one (111.111.1.11 in the example above)?

Garrett


February 28, 2010 | 11:13 pm

Try using [regexp] to pick out the one that looks like an IP address, here’s an example.

lh

– Pasted Max Patch, click to expand. –

March 1, 2010 | 4:25 pm

hi, can you show me a screen shot of what you have done, I’m on 4.6. Not sure why I need to pull out the IP address, surely I need to count whats coming out of mxj net.local?

Garrett


March 1, 2010 | 5:04 pm

scratch that, clearly I didn’t have my brain with me yesterday when I was coding, it’s just a matter of using a trigger in front of the mxj net.local object to time the bang at the end of the output (as below and not a regexp in sight phew!). I will now go and slap myself on the back of the head – thanks for your help.

Garrett

max v2;
#N vpatcher 472 292 826 595;
#P origin 0 26;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 210 181 43 196617 print ip;
#P message 194 126 33 196617 clear;
#P user umenu 120 160 100 196647 1 64 176 1;
#X add 192.168.1.85;
#X add fe80:0:0:0:217:f2ff:fee7:98f5%6;
#P message 120 106 24 196617 en1;
#P newex 105 79 40 196617 t b b b;
#P button 105 46 28 0;
#P newex 120 125 68 196617 mxj net.local;
#P connect 1 0 2 0;
#P connect 2 1 3 0;
#P connect 3 0 0 0;
#P fasten 5 0 4 0 199 150 125 150;
#P connect 0 0 4 0;
#P fasten 2 0 4 0 110 150 125 150;
#P fasten 2 2 5 0 140 101 199 101;
#P connect 4 1 6 0;
#P pop;


March 1, 2010 | 5:16 pm

Oops. It was a [route append] followed by [regexp ((?:\d{1,3}\.){3}\d{1,3})] but your method works just as well.

lh


March 1, 2010 | 5:26 pm

ah ok, I try to avoid regular expressions if possible, they are useful but a nightmare to write.

I missed a bang in mine, works better now!

max v2;
#N vpatcher 472 292 826 595;
#P origin 0 26;
#P window setfont "Sans Serif" 9.;
#P newex 209 181 43 196617 print ip;
#P message 190 126 33 196617 clear;
#P user umenu 119 160 100 196647 1 64 176 1;
#X add 192.168.1.85;
#X add fe80:0:0:0:217:f2ff:fee7:98f5%6;
#P message 119 103 24 196617 en1;
#P newex 97 79 78 196617 t b b b b;
#P button 97 45 28 0;
#P newex 119 125 68 196617 mxj net.local;
#P connect 1 0 2 0;
#P connect 2 1 3 0;
#P fasten 2 2 0 0 146 121 124 121;
#P connect 3 0 0 0;
#P fasten 2 0 4 0 102 150 124 150;
#P fasten 5 0 4 0 195 150 124 150;
#P connect 0 0 4 0;
#P fasten 2 3 5 0 168 112 195 112;
#P connect 4 1 6 0;
#P pop;


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