Hello.
I don't think i'll be complicated to do but does someone could help me to create a script
that get a comma text to create array ?
I try to transform string to integer by changing tparameter by tarray but it doesn't work
comma text to arry
can't really help you but I've found this in my archives , exactly the inverse of what you're looking for, maybe a inspiration source
Code: Select all
//////////////////////////
// Array values (INTEGERS) to commaText
/////////////////////////
CONST MAX_ITEMS = 160;
var ArrayIn, CommaOUT: Tparameter;
var SL1: TstringList;
/////////////////////////////
procedure init;
var i: integer;
begin
ArrayIn:= CreateParam('ArrayIn', PtArray);
SetIsOutput(ArrayIn,False); SetMin(ArrayIn,0); setMax(ArrayIn,MAXINT);
CommaOUT:= CreateParam('CommaOUT',PtTextField);
setisINPUT(commaOut,false);
SL1:= Tstringlist.create;
SL1.commatext:='';
for i:= 0 to MAX_ITEMS -1 do begin SL1.add(' ');end;
END;//INIT
///////////////////////////////////////////
Procedure Callback(N:integer);
var i, L: integer;
begin
if (n=ArrayIn) then begin
L:= getLength(ArrayIn);
if L< MAX_ITEMS then begin
For i:= 0 to L-1 do begin
SL1.strings[i]:= IntToStr(trunc(getDataArrayValue(ArrayIn,i)));
end;
//Strace(SL1.commatext);
setStringValue(CommaOut,SL1.commatext);
end;
end;
END;//CB
////////////////////////////////////////
Procedure Destroy;
begin
SL1.free;
end;
///////////////////////////////For who are interested (i wonder why someone could be interested by this except me
) :
Thank to senso.
//////////////////////////
// Array values (INTEGERS) to commaText
/////////////////////////
var ArrayOut, CommaIn: Tparameter;
var SL1: TstringList;
/////////////////////////////
procedure init;
var i: integer;
begin
CommaIn:= CreateParam('Comma In',PtTextField);
setisOutput(commaIn,false);
ArrayOut:= CreateParam('Array Out', PtArray);
SetIsInput(ArrayOut,False);
SetMin(ArrayOut,0);
setMax(ArrayOut,MAXINT);
SL1:= Tstringlist.create;
SL1.commatext:='';
END;//INIT
///////////////////////////////////////////
Procedure Callback(N:integer);
var i, L: integer;
begin
SL1.CommaText := GetStringValue(CommaIn);
Strace(SL1.commatext);
L := SL1.Count;
SetLength(ArrayOut,L);
For i :=0 to L-1
do SetDataArrayValue(ArrayOut,i,StrtoFloat(SL1.strings));
END;//CB
////////////////////////////////////////
Procedure Destroy;
begin
SL1.free;
end;
///////////////////////////////
Thank to senso.
Thanks Joffo and Senso, I was searching for that a few weeks ago, but forgot why....
Maybe I'll find out again
Maybe I'll find out again
-
woodslanding
- Member
- Posts: 1327
- Contact:
Oh, I use that.....
I will see if this code is cleaner than what I'm using (probably so, if it's from Senso!)
I will see if this code is cleaner than what I'm using (probably so, if it's from Senso!)
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Who is online
Users browsing this forum: No registered users and 26 guests
