Problems writing a list of numbers separated by commas to text file
I am trying to use the text object to output data to a text file, which will later be read by a visual basic script in excel. HOwever the vba part is not important for this question, I am just expplaining why i need the data to be in a certain format.
i will have 5 numbers between 1 and 20 that will be changing due to certain things in the patch and I need to figure out how I can send these numbers in a list separated by commas to the text object.
say the numbers are 5 4 8 7 3, i would need 5, 4, 8, 7, 3 to be sent to the text file, and then say the numbers changed to 5 4 8 7 4 I would then need 5, 4, 8, 7, 4 to be sent to the text file. I am thinking of having the message being sent to the clear object to clear the text file and then to the text object and then to the write object so that each time the data is changed the old data gets deleted and then the new data gets entered, although if there is a way how it would only replace the data in the file that is different that woul dbe even better.
I know that if i had the numbers being generated and sent to a number box that would create the list of numbers that I want, i just do not know how to then put them into a list separated by commas. I have tried using the pack object but it just seems to create a list without commas. I have also tried to use the append object with a commas after so it sets out the number followed by a comma but that doesn’t appear to work either. Does anyone know how i can do this?
Thanks very much in advance!
I had a quick look and don’t see any text storing objects that don’t remove commas. The help for message shows how to create a message with commas, but that doesn’t help you much.
I used to use bbedit for such text-mangling operations. Haven’t used it in ages, but I assume it will work. It is only OSX:
Try using [sprintf] and escaping the comma using a like in the patch below. You could also get the [trigger] to send a "write some/destination/file.csv" message to save it to disk.
----------begin_max5_patcher---------- 534.3ocyWtsbaBCDF9Z3oPilo2Q8nUHN3dWeNZxzQ1n3nTPv.xScZl7tWjjo 9vXrwoNfuQXs5z+9wxtxu46gWTtQzfQeC8Cjm2a9ddVSFCda66gK3aVlyarS CqD+tbwK3.2PZwFs0bSUsToeB07ZQ4ZM5K4YO7PPuO5VdEWu7YoZ0OqEK0NU Le9LR.ZN0zRCA6CxLB5wsK4oRkVwKD1S860Rdd2loVWHU4BsUmQ6L1pmNqvd aRi7O1MALGkyrLytqs92WYIcaqa45WqDNAhwnGMi7tuuoIXnbacwBQ8Yb7Pf LKIJ.wRM9bD4i54vI8b5v8bRudd6aXb.BufqV8IAAZTxcADBSmRHPX2GPHdB g.DA2GPfMgPvkLbxQ.8SDAmtbRE+WH.QQgHFJ5h.JgLwUKnzac0hSiEMJGsL WvubLC.I1Pm4SVYDnejzFw37hODaJDMM7Uhyl6XeF.f86GS60BA5+abQ7HEW X9wECIX1KUwhusgDgClFP5YCIrIQBb4TN.NVchykpiuop0UM1OjXMkqqW1sy cIvP6b2LQiVp3ZYoZuIQObROKyxD1w67jBYVUYq31Jhdd+MXMwFplfwSSwCU SzwSSoCUSgillLWQdXZhMZZhNjXby+pYDiwO535gSwWWLNPRmEYxpyr4whS9 WuwPslxZiIAgCfyo0DjdcZBBcDLzUVfrq2sPsjarZOpTf+69+EPikR8v -----------end_max5_patcher-----------
That "symout" thing in sprintf would have come in handy in my past. Gotta look at help patches more carefully I guess.
Mate!!! Thank you so much, I am so happy now! All about the bristol massive!!!
Forums > MaxMSP