//Make a group called "string_curves" and a hierarchy of "st_joints*"//

select -cl;
select -hi stB_joint1;
select -d "*Shape*";
select -d "*Cluster*";
string $string_joints[] = `ls -sl`;
select -cl;
select -hi lat_clusters;
select -d lat_clusters;
select -d "*Shape*";
string $string_clusters[] = `ls -sl`;
select -cl;
select -hi bodyCurves;
select -d bodyCurves;
select -d "*Shape*";
string $string_curves[] = `ls -sl`;
int $time = 3;

for ($i = 0; $i < size($string_curves); $i++) {
select -cl;
currentTime $time;

//first set the size of the string to the size of the curve//

float $curvelen = `arclen $string_curves[$i]`;
float $jointlen = $curvelen/99;

string $JNTlenx = ($string_joints[0]+".translateX");
string $JNTleny = ($string_joints[0]+".translateY");
string $JNTlenz = ($string_joints[0]+".translateZ");
setAttr $JNTlenx 0;
setAttr $JNTleny 0;
setAttr $JNTlenz 0;

for ($m = 1; $m < size($string_joints); $m++) {
string $JNTlenx = ($string_joints[$m]+".translateX");
string $JNTleny = ($string_joints[$m]+".translateY");
string $JNTlenz = ($string_joints[$m]+".translateZ");
setAttr $JNTlenx $jointlen;
setAttr $JNTleny 0;
setAttr $JNTlenz 0;
}

//now add the spline//

select -r $string_joints[0];
select -add $string_joints[(size($string_joints) - 1)];
select -add $string_curves[$i];
ikHandle -sol ikSplineSolver -ccv false;

//now key the joints//

for ($u = 0; $u < size($string_joints); $u++) {
string $curJNT = ($string_joints[$u]);
setKeyframe -breakdown 0 $curJNT;
}

select -cl;
select -r effector1 ;
doDelete;

//this Part fixes the first joint which won't attach to the string//

string $curCV = ($string_curves[$i]+".cv[0]");
select -r $curCV;
cluster -n "TmpCluster1";

string $curJNT = ($string_joints[0]+".translate");
select TmpCluster1Handle;
select -add $string_joints[0];
pointConstraint -offset 0 0 0 -weight 1;
setKeyframe -breakdown 0 $curJNT;
select TmpCluster1Handle;
doDelete;

//now constrain the lattice clusters//

for ($k = 0; $k < size($string_clusters); $k++) {
string $curCluster = ("stB_Cluster"+($k+1)+"Handle");
string $pointcnstr = ("stB_Cluster"+($k+1)+"Handle_pointConstraint1");
string $orientcnstr = ("stB_Cluster"+($k+1)+"Handle_orientConstraint1");
select -r $string_joints[$k];
select -add $string_clusters[$k];
pointConstraint -offset 0 0 0 -weight 1;
orientConstraint -offset 0 0 0 -weight 1;
setKeyframe -breakdown 0 $curCluster;
select -r $pointcnstr;
select -add $orientcnstr;
doDelete;
}

$time = ($time + 1);
currentTime $time;
for ($v = 0; $v < size($string_joints); $v++) {
select -r $string_joints[$v];
timeSliderClearKey;
}

$time = ($time + 1);

}

Go back to String Creation.