-
-
Save cg-method/e0fb5799dd38a3ae13eb7ee7c5ec838c to your computer and use it in GitHub Desktop.
【Photoshop】画像アセット用にリネーム.jsx
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
var doc = app.activeDocument; | |
doc.activeLayer = doc.layers.getByName("リネーム"); | |
var fileName = doc.name; | |
var fileName = baseName(fileName); | |
//レイヤーリネーム | |
doc.activeLayer.name = fileName + ".png" + "," + "32x32 fileName" + ".png"; | |
//保存して閉じる | |
doc.save(); | |
doc.close(); | |
//拡張子を抜く | |
function baseName(str) { | |
var base = new String(str).substring(str.lastIndexOf('/') + 1); | |
if (base.lastIndexOf(".") != -1) | |
base = base.substring(0, base.lastIndexOf(".")); | |
return base; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment