Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

replaceWithPlaceholder method throwing char limit error

$
0
0

Hey Everyone,

 

Long time lurker first time poster...I wrote a script to replace my selected footage items with placeholders, but when i run it on footage items with particularly long names, I get an error:

 

"The String is too long, it can only be 31 bytes after conversion."

 

The script itself is below, any ideas on how to get around this limitation?  Running CC 12.2.1.5  Thanks!

 

app.beginUndoGroup("Convert Footage to Placeholders");  
var proj = app.project;  
var selectedItem = app.project.selection;
var numSelectedItems = selectedItem.length;  
var defaultWidth = 1920;
var widthPromptText = "Placeholder Width"
var getwidth = prompt(widthPromptText, defaultWidth);
var width = parseInt(getwidth);  
var defaultHeight = 1080;
var heightPromptText = "Placeholder Height"
var getheight = prompt(widthPromptText, defaultHeight);
var height = parseInt(getheight);    for (var i = 1; i <= proj.numItems; i++) {          if (proj.item(i).selected) {                    var theItem = proj.item(i);                    var itemName = theItem.name;                    //alert(itemName); //works just fine, i get the names just fine                    var compFR = theItem.frameRate;                    var compDuration = theItem.duration;                    proj.item(i).replaceWithPlaceholder(itemName, width, height, compFR, compDuration);          }}    
alert("all done");

Viewing all articles
Browse latest Browse all 2143

Trending Articles