Script Error(s)
Posted: April 5th, 2006, 10:08 am
I am a new poster and a beginner at scripting. Last week there was a post on the AE List mentioning a French site called nabscripts.com.
On that site was a script that created triangles and Carpet of Sierpinsky triangles. I wanted very much to try the script, but the downloaded script file had numerous word wrap and (apparently) nesting errors.
I've fiddled with the following function for several hours, and can't get the AE ExtendScipt window to run it. I think it has to do with the if...else statements, and I know that the brackets must match. But I can't find any help in the AE javascript debugger or the scripting guide of how to identify the error(s).
Any help getting the following function to work properly would be very much appreciated. Any suggestions for learning how to debug would also be welcome.
---------------
Code
---------------
function Triangle()
{app.beginUndoGroup("SierpinskyTriangle.jsx");
if(!app.project)
alert("Vous must initially open a project and select a copy"); }
else
{var myComp = app.project.activeItem; yew (myComp == null ||!(myComp instanceof CompItem))
alert("Vous must select a copy");
else
{yew (myComp.selectedLayers.length! = 1),
alert ("Vous must select one and only one copy.");
else
{yew (MaxIterationsEdit.text == ""),
alert("Vous must initially specify the iteration count.") }
else
{var myLayer = myComp.selectedLayers[0 ];
var W = myLayer.width;
var H = myLayer.height;
var D = 10;
//borders in px
var A = [ W/2, D ];
var B = [ D, H-d ];
var C = [ W-d, H-d ];
SierpinskyTriangle(myLayer, A, B, C);
}}}}
app.endUndoGroup(); }
----------
End code
----------
Thanks,
--Jim Sphar
On that site was a script that created triangles and Carpet of Sierpinsky triangles. I wanted very much to try the script, but the downloaded script file had numerous word wrap and (apparently) nesting errors.
I've fiddled with the following function for several hours, and can't get the AE ExtendScipt window to run it. I think it has to do with the if...else statements, and I know that the brackets must match. But I can't find any help in the AE javascript debugger or the scripting guide of how to identify the error(s).
Any help getting the following function to work properly would be very much appreciated. Any suggestions for learning how to debug would also be welcome.
---------------
Code
---------------
function Triangle()
{app.beginUndoGroup("SierpinskyTriangle.jsx");
if(!app.project)
alert("Vous must initially open a project and select a copy"); }
else
{var myComp = app.project.activeItem; yew (myComp == null ||!(myComp instanceof CompItem))
alert("Vous must select a copy");
else
{yew (myComp.selectedLayers.length! = 1),
alert ("Vous must select one and only one copy.");
else
{yew (MaxIterationsEdit.text == ""),
alert("Vous must initially specify the iteration count.") }
else
{var myLayer = myComp.selectedLayers[0 ];
var W = myLayer.width;
var H = myLayer.height;
var D = 10;
//borders in px
var A = [ W/2, D ];
var B = [ D, H-d ];
var C = [ W-d, H-d ];
SierpinskyTriangle(myLayer, A, B, C);
}}}}
app.endUndoGroup(); }
----------
End code
----------
Thanks,
--Jim Sphar