Known Participant
June 24, 2022
Question
Photoshop Script for opening template action and adding selected files into folder
- June 24, 2022
- 2 replies
- 2447 views
Can someone help me with this photoshop script
I have created an action to automatically create an document with 3 artboards:
app.doAction("Create Document","APP IMAGES")
I want to be able to select a group of images in finder, and the run the script to create the template document above and place linked images into 3 separate artboards (already in the template):
The artboards are called (and will never change):
SQ 2400x2400
VT 1800x2474
VT 2400x3000
I then have 3 separate scripts (below) to rename the filenames by group:
for (var i = 0 ; i < app.activeDocument.activeLayer.layers.length ; i++)
{
var LAYER = app.activeDocument.activeLayer.layers[i];
var VISIBLE = LAYER.visible;
// replace ' ' with ' '
//Script takes entire variable name and adds prefix and suffix
LAYER.name = LAYER.name.replace(/\.[^\.]+$/, '');
var newLayerName = "2400x2400 SQ 2400x2400/" + LAYER.name + ".png";
LAYER.name = newLayerName;
LAYER.visible = VISIBLE
}
for (var i = 0 ; i < app.activeDocument.activeLayer.layers.length ; i++)
{
var LAYER = app.activeDocument.activeLayer.layers[i];
var VISIBLE = LAYER.visible;
// replace ' ' with ' '
//Script takes entire variable name and adds prefix and suffix
LAYER.name = LAYER.name.replace(/\.[^\.]+$/, '');
var newLayerName = "1800x2474 VT 1800x2474/" + LAYER.name + ".png";
LAYER.name = newLayerName;
LAYER.visible = VISIBLE
}
for (var i = 0 ; i < app.activeDocument.activeLayer.layers.length ; i++)
{
var LAYER = app.activeDocument.activeLayer.layers[i];
var VISIBLE = LAYER.visible;
// replace ' ' with ' '
//Script takes entire variable name and adds prefix and suffix
LAYER.name = LAYER.name.replace(/\.[^\.]+$/, '');
var newLayerName = "2400x3000 VT 2400x3000/" + LAYER.name + ".png";
LAYER.name = newLayerName;
LAYER.visible = VISIBLE
}
Then, marketing can move around the images to their liking.
And I can just generate > assets neatly into correct groups, correct names and extenstions, and deliver it back to them immediately. This process will be used every time we have new images. It is not a one off.
It works, but I have a bunch of actions I have to click to execute it.
I am looking to combine it all together in one script. Anyone know how to do this?
