Created
March 30, 2017 10:48
-
-
Save p2or/e61a42118e98a5661391ca2ab0cc68c0 to your computer and use it in GitHub Desktop.
Rename Selection #Illustrator
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 addLeadingZeros (n, length){ | |
var str = (n > 0 ? n : -n) + ""; | |
var zeros = ""; | |
for (var i = length - str.length; i > 0; i--) | |
zeros += "0"; | |
zeros += str; | |
return n >= 0 ? zeros : "-" + zeros; | |
} | |
var docRef = activeDocument; | |
var sel = docRef.selection; | |
for (var i=0; i < sel.length; i++){ | |
sel[i].name = "obj_" + addLeadingZeros(i, 4); | |
}; | |
app.redraw(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment