AFX Script Problem Visual Studio Code
Hi,
i recently started scripting and wrote a script in VS Studio for After Effects, which works fine when i run it from Visual Studio. But when i save it and run the script from After Effect it gives me an error message: "unable to execute at line 20..."
which is a function in my script. everything before gets executed.
I have Variables (a,b) in my function because i am looking for several Objects meaning CompItem, FootageItem, Folderitem where I'm looking for specific names as a string.
The Function looks like that:
function graballItems(a, b) {
var proj, curItem, itemTotal, ItemAry;
proj = app.project;
itemTotal = proj.numItems;
ItemAry = new Array();
for (var i = 1; i <= itemTotal; i++) {
curItem = proj.item(i);
if (curItem instanceof b && curItem.name.indexOf(a) !== -1) {
ItemAry = curItem;
}
}
return ItemAry;
}
// And i use it like that:
var myCompBeauty = graballItems("CAN_ENDTAG_PRE", CompItem);
But strange though, that it is working from VS Studio.
Does anybody know why the error message appears?
Cheers
Martin
