Page 1 of 1
Posted: 05 Jan 2010, 10:04
by woodslanding
I'd like to take a comma text input and split it out to seperate outputs. The opposite of concatenate. (I have to name 20 effect returns (20 times!) so I can mix them all together, and it's a huge number of usine objects to name. Like to autoname them from a script.)
Has this been done? I couldn't find an example. Does comma-text have quotes on each element that have to be stripped out? Commas?
I think I can figure it out, but not tonight--too late. But any tips welcome.
Wouldn't be necessary at all if usine mixed busses same as other objects
but this is "not how it's done".
Thanks!
-e
Posted: 05 Jan 2010, 10:34
by 23fx23
bsork did a great script for that callled "comma text to separate elements" should be in addons.
or to make it in patch, I usually cascade several list box with same comma in, to each next I add 1 to input.
so that first list ouputs text 1, second text 2 ect, but from same comma in that will update all if changed.
In my square add on I made a system like this:
every bus name is linked to the text output of a list box. all list box receive same comma text from a bus "comma text"
then bus 1 list box is set on 1, bus 2 on 2 ect, update master list will update all as well.
hope it helps.
look like this:

Posted: 06 Jan 2010, 09:55
by woodslanding
here's the answer in case it helps somebody else someday:
Code: Select all
/// commastring splitter by emoon//////
const stringCount = 6; // if this is too small, it doesn't like it.....
var outputs : array of Tparameter;
var input : Tparameter;
var strings : array of String;
var commatext : String;
// destroy
// initialisation : create parameters
procedure init;
var digit : string;
var i : integer;
begin
input := CreateParam('commaText',ptTextField);
SetIsOutput(input,false);
setArrayLength(strings, stringCount);
setArrayLength(outputs, stringCount);
for i := 0 to (stringCount - 1) do begin
digit := IntToStr(i + 1);
outputs[i] := CreateParam('String ' + digit,ptTextField);
SetIsInPut(Outputs[i],false);
end;
end;
procedure Callback(n:integer);
var charCount : integer;
var i : integer;
var ch: string;
var pos: integer;
begin
commatext := ' ' + getStringValue(Input) + ',';
i := 0;
charCount := 0;
for pos := 1 to length(commatext) do
begin
ch := copy(commatext,pos,1);
if (ch = ',') then
begin
strings[i] := copy(commatext,pos - charCount + 1, charCount - 1);
SetStringValue(Outputs[i],strings[i]);
strace('in loop ' + strings[i]);
// a little bounds checking
if (i = length(strings)) then break;
i := i + 1;
charCount := 0;
end;
charCount := charCount + 1;
end;
end;
// no process bloc
Posted: 06 Jan 2010, 10:31
by 23fx23
I will check that ,cool thanks for sharing.
Posted: 06 Jan 2010, 10:55
by amiga909
nice script, thanks!
Posted: 09 Mar 2010, 00:03
by 23fx23
hey woodslanding, i use a lot your script, i was wondering if you hadn't a reverse version maybe?, from severals text in create a comma text? i make my patch version but it would be more efficient with script i suppose , arf, i reaaly need to dive into!