From 2b0bebfdc0b82b825102208af372071235459d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1ssquez=20P=C3=A9rez?= Date: Wed, 2 Nov 2016 20:27:43 -0700 Subject: [PATCH] Still can't replace photoshop layers properly. --- jsx/ReplaceAllFiles.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsx/ReplaceAllFiles.jsx b/jsx/ReplaceAllFiles.jsx index 49e8fe0..618c49e 100644 --- a/jsx/ReplaceAllFiles.jsx +++ b/jsx/ReplaceAllFiles.jsx @@ -1 +1 @@ -app.beginUndoGroup("ReplaceAllFiles"); var project = app.project; var new_path =prompt("Enter new path for footage:","/","New Path"); function getFootageItems() { footageItems =[]; for ( var i = 1 ; i < project.items.length ; i ++ ) { footageItem = project.items[i]; if ( footageItem.typeName == "Footage" && footageItem.file != null ) { footageItems.push(footageItem); } } return footageItems; } function getLastFolder( file_path ) { tree = file_path.split("/"); lastFolder = tree[tree.length-1]; return lastFolder } function replaceFiles( footageItems, path ) { seq_ptn = new RegExp("\[[0-9\-].*\]","g"); for ( var i = 0 ; i < footageItems.length ; i ++ ) { var footageItem = footageItems[i]; if ( footageItem.mainSource.isStill == true || footageItem.name.match ( seq_ptn ) == null ){ footageItem.replace( File( new_path + footageItem.name ) ); } else { footageItem.replaceWithSequence( File( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ), false ); //alert( new_path + footageItem.file.name ); //alert( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ); } writeLn("Replacing :" +footageItem.file.name ); } writeLn("Booyakasha!"); } clearOutput(); replaceFiles( getFootageItems() , new_path ); app.endUndoGroup(); \ No newline at end of file +app.beginUndoGroup("ReplaceAllFiles"); var project = app.project; var new_path =prompt("Enter new path for footage:","/","New Path"); function getFootageItems() { footageItems =[]; for ( var i = 1 ; i <= project.items.length ; i ++ ) { footageItem = project.items[i]; if ( footageItem.typeName == "Footage" && footageItem.file != null ) { footageItems.push(footageItem); } } return footageItems; } function getLastFolder( file_path ) { tree = file_path.split("/"); lastFolder = tree[tree.length-1]; return lastFolder } function replaceFiles( footageItems, path ) { seq_ptn = new RegExp("\[[0-9\-].*\]","g"); for ( var i = 0 ; i < footageItems.length ; i ++ ) { var footageItem = footageItems[i]; if ( footageItem.mainSource.isStill == true || footageItem.name.match ( seq_ptn ) == null ){ footageItem.replace( File( new_path + footageItem.file.name ) ); } else { footageItem.replaceWithSequence( File( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ), false ); //alert( new_path + footageItem.file.name ); //alert( new_path + getLastFolder( footageItem.file.path ) +"/"+ footageItem.file.name ); } writeLn("Replacing :" +footageItem.file.name ); clearOutput(); } writeLn("Booyakasha!"); } clearOutput(); replaceFiles( getFootageItems() , new_path ); app.endUndoGroup(); \ No newline at end of file