I have about a dozen of these scripts in my WKP, and when I first open the WKP, about 5-10% of the time one of these scripts will fail in a particular way.
Specifically, the lines:
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_STRING_VALUE','LIST','comma text',SL1.getCommatext);
Cause commaText from one script to be inserted into different instance in another patch in another rack in the WKP. (There is no rack that contains 2 of these scripts.)
Any thoughts of what might be going on? Maybe it's an IML bug, but maybe I'm making a stupid (or advanced!) mistake in my script.
I can post the patch that contains it, but I can't see how the wiring would affect this. And it has been a problem with this script since V5.
Thoughts, script gurus??? Is there a way to keep this part of the script from running at startup? Hmmm. Or keep the whole script from running at startup??? I guess I could use on init, and a timer, but that seems particularly kludgey
Thanks!!
-e
Code: Select all
// 256 presets Manager______________________23fx 05/06/2k10//
/////////////////////////////////////////////////////////////
// Based on guru logic 128 pm manager //
// name PMs P_X. // //
// updated for HH by E. Moon //
/////////////////////////////////////////////////////////////
Const PM_Prefix = 'P_';
Const PM_SIZE = 32;
////////////////////////////////////////////////////////
var num,bankIN,store,clear,Msdwn : Tparameter;
var Pm_name, Pm_num : string;
var pmnum,bankNum: integer;
var MSD: boolean;
var commain, clickIN, txtin: tparameter;
var SL1: tstringlist;
var editing : boolean;
///////////////////////////////////////////////////////////////////////
Procedure Init;
BEGIN
num := CreateParam('list num',PtDataField) ;setIsOutput(num,false);
commain:= createparam('commain',pttextfield); setisoutput(commain,false);
Msdwn:= CreateParam('list msdwn',PtDataField);setIsOutput(msdwn,false);
store:= CreateParam('store',PtDataField);setIsOutput(store,false);
clear:= CreateParam('clear',PtDataField);setIsOutput(clear,false);
txtin:= createparam('txtin',pttextfield);setisoutput(txtin,false);
clickIN:= createparam('txtfield clk',ptdatafield); setisoutput(clickIN,false);
SL1.create;
editing:= FALSE;
MSD:=false;
END;
/////////////////////////////////////////
Procedure destroy;
begin SL1.free end;
//////////////////////////////////////////////////////////////////
Procedure callBack(n : integer);
BEGIN
if (n=clickIN)and (getvalue(clickIN)=1) then begin
// user is editing
editing:=TRUE;
end;
if (n=commain) then begin
SL1.setCommatext(getstringvalue(commain));
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_STRING_VALUE','LIST','comma text',SL1.getCommatext);
end;
if (n=txtin) AND (editing) then begin
SL1.setStrings(trunc(getvalue(num)),getstringvalue(txtin));
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_STRING_VALUE','LIST','comma text',SL1.getCommatext);
editing:= FALSE;
end;
if (n=msdwn) then begin
MSD:=getvalue(msdwn)=1;
end;
if (n=num) then begin
SL1.setCommatext(getstringvalue(commain));
pmnum:= trunc(getvalue(num));
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_STRING_VALUE','TXT','1',SL1.getstrings(pmnum));
Pm_name:= PM_Prefix+ intToStr(pmnum div PM_SIZE);
Pm_num := intToStr(pmnum mod PM_SIZE);
end;
if (n=msdwn) and (getValue(Store) = 1) and (msd) then begin
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_VALUE',Pm_name,'store','1');
SendInternalMsg4('SET_VALUE',Pm_name,'store','0');
SendInternalMsg4('SET_VALUE',Pm_name,'num',pm_num);
SendInternalMsg4('SET_VALUE','STORE','1','0');
end;
if (n=msdwn) and (getValue(Clear) = 1) and (msd) then begin
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_VALUE',Pm_name,'clear','1');
SendInternalMsg4('SET_VALUE',Pm_name,'clear','0');
SendInternalMsg4('SET_VALUE',Pm_name,'num',pm_num);
SendInternalMsg4('SET_VALUE','CLEAR','1','0');
end;
if ((n=num))
and ((getValue(store)=0) and (getValue(Clear)=0))
then begin
SendInternalMsg2('SET_TARGET_PATCH','SENDER_PATCH');
SendInternalMsg4('SET_VALUE',Pm_name,'recall '+pm_num,'1');
SendInternalMsg4('SET_VALUE',Pm_name,'recall '+pm_num,'0');
end;
END;
//////////////////////////////////////////////////////////