Created
August 17, 2019 21:02
-
-
Save kostimarko/a9a5e034ba363b48611ab9094e48baeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNewName(layerName){ | |
// Local Variables | |
var docName; | |
// Set docName to the source doc name | |
docName = sourceDoc.name; | |
// Set newName to empty string | |
var newName = ""; | |
// Get the last underscore in the document name | |
var underscore = docName.lastIndexOf('_'); | |
// Set newName to the docName from the first char to the last underscore | |
newName += docName.substring(0,underscore); | |
// Set newName to underscore + layerName | |
newName += '_' + layerName; | |
// Save in file at destFolder and newName | |
saveInFile = new File(destFolder + '/' + newName); | |
// Return saveInFile that creates file at folder path | |
return saveInFile; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment