First time here? Check out the FAQ!

Using a script to set IP Address in multiple locations - dealing with decimal points / string

0 votes

I've got a sound using a number of NEL Send OSC protoypes to send osc out of Kyma and onto a Monome Grid.  This works really nicely.  Within the Send OSC prototype you type in the IP Address as a parameter directly.  Because I have a number of these prototypes each time I restart my computer/Kyma and get a new IP Address I have to replace in multiple locations.  I thought I'd try my first script to mean I can change in just one location and have all the protoypes update by using the ?ipAddress variable.

My script is below.  I think it's working in approach however, the iP Address is being passed through as a string I think along with the ' ' at start and end.  In the Send OSC if you enclose the IP Address in ' ' it doesn't work.  I can't get the script to work however within anything other than the ' ' around the setIpAddress variable - the decimal points in the address confuse it.  

What's the best way to tackle this please? I've tried using ipAddress: setIpAddress asNumber but this also doesn't work.


| setIpAddress |

setIpAddress := ''.

(inputs at: 1)

start: 0 s

ipAddress: setIpAddress
asked Aug 14, 2020 in Capytalk & Smalltalk by ghood (Master) (3,060 points)
Your script looks correct. The SendToIP field is a string parameter so it won't show quote marks in the parameter window but the quote marks you have in your script won't be causing a problem, in fact, as you've seen, they are necessary to create a string in Smalltalk.

What did you have in your SendToIP field? Did you have:




How do you know it's not working? Are you getting some kind of error?

No error, just didn’t work. I’ll try with curlies! Thanks. I got round it by fixing my IP address which is probably better tbh but it would be good to still find an alternative fix!

2 Answers

0 votes
This depends on the parameter field type containing the green variable, ?setIpAddress (in the Input to the Script). If the parameter field expects a String, then what you have written here will work (so maybe it does not expect to see a String?)
answered Aug 14, 2020 by ssc (Savant) (127,180 points)
It expects just the IP address with no ‘ ‘ around.
I guess you could try passing it in as:


but this is really a question for Cristian, since we don't know how he designed his Sound.
From what Cristian has said I understand it’s expecting a string but that the problem is a script can’t pass a string. Is this a hard limitation or something that could be changed at SSC end? Thanks
Actually, a Script *can* pass a string argument (you've probably done it in the past by passing the name of a sample, for example). Have you tried passing the address inside an Array as:
#( ?
Hi SSC. Yes, Cristian mentioned worked with file names but not in this instance. I tried with an array but that didn’t seem to work either. I’ll give it another go and then maybe explore using a ?greenvariable or something that pops up to let me input ipAddress just the once. Lastly, I could look into creating a fixed IP though I’m not sure how. Thanks anyway!
You could try changing the type of the NEL parameter field to StringOrNil (instead of String).
0 votes
My solution does not answer your original question, but offers another way of approaching the same issue. I have a router in my studio rack, that is connected to my computer, soundcard and kyma. I use static IP's for all the equipment I use OSC with. List includes 3 raspberryPi's, Paca, couple of macbook pro's mac mini and my studio hackintosh. Good thing is that the rack travels with me, so the IP's don't change even when I'm away from my studio. I also use iPhone as an USB-modem to get an internet connection.

I have a notepad where I have a list where I have written down all the IP's and when I use OSC the target IP's never change. I use Lemur on my iPad, PureData on the rasPi's and NEL-osc on Kyma.
answered Aug 29, 2020 by anssi-laiho (Adept) (1,150 points)
Thank you. I ended up doing similar, creating a fixed IP.