Hi,
I'm working on Photoshop CS6 and I need script to make my life a bit easier. I don't know a thing about script, and I need a helping hand here.
I need a script that help me to choose a psd file in a directory containing thousands. The directory contains psd incremented files from something like 1 to 999, more or less, and as I said, I need a window or something like this to allow me to enter the number or name of the required file, make photoshop opens the file and make a specific action that i’ve create on it .
Also I need a script to make a direct save of a working file, in a specific directory, allways the same one. It look simple, but when I open a file elsewhere on the server, photoshop want to save it on the place where it come from, but I need it to save at a single location.
Thank you for helping me ...
Need help for script from a non-initiate
-
Paul MR
Need help for script from a non-initiate
Here are a couple of scripts you could try...
Code: Select all#target photoshop
main();
function main(){
selectedFolder = Folder.selectDialog( "Please select source folder",$.getenv("LastFolder"));
if(selectedFolder == null ) return;
$.setenv("LastFolder",decodeURI(selectedFolder));
var fileList = selectedFolder.getFiles("*.psd");
var result = prompt("Please enter number for " + decodeURI(fileList[0].name).replace(/\d+.psd$/,'') ,'');
if(result == null ) return;
var file = File(decodeURI(fileList[0]).replace(/\d+.psd$/,'') + result +".psd");
if(!file.exists){
alert(decodeURI(file.name) +" does not exist!");
return;
}
open(file);
};
This script will prompt for the output folder only once per session of Photoshop.
Code: Select all#target photoshop
main();
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
Name = Name.replace(/\d+$/,'');
var savePath = $.getenv("incrementalFolder");
if(savePath == null){
var savePath = Folder.selectDialog( "Please select output folder");
if(savePath == null) return;
$.setenv("incrementalFolder",decodeURI(savePath));
}
var fileList= Folder(savePath).getFiles(Name +"*.psd").sort().reverse();
var Suffix = 0;
if(fileList.length){
Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/));
}
Suffix= zeroPad(Suffix + 1, 3);
var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".psd");
SavePSD(saveFile);
}
function SavePSD(saveFile){
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
Code: Select all#target photoshop
main();
function main(){
selectedFolder = Folder.selectDialog( "Please select source folder",$.getenv("LastFolder"));
if(selectedFolder == null ) return;
$.setenv("LastFolder",decodeURI(selectedFolder));
var fileList = selectedFolder.getFiles("*.psd");
var result = prompt("Please enter number for " + decodeURI(fileList[0].name).replace(/\d+.psd$/,'') ,'');
if(result == null ) return;
var file = File(decodeURI(fileList[0]).replace(/\d+.psd$/,'') + result +".psd");
if(!file.exists){
alert(decodeURI(file.name) +" does not exist!");
return;
}
open(file);
};
This script will prompt for the output folder only once per session of Photoshop.
Code: Select all#target photoshop
main();
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
Name = Name.replace(/\d+$/,'');
var savePath = $.getenv("incrementalFolder");
if(savePath == null){
var savePath = Folder.selectDialog( "Please select output folder");
if(savePath == null) return;
$.setenv("incrementalFolder",decodeURI(savePath));
}
var fileList= Folder(savePath).getFiles(Name +"*.psd").sort().reverse();
var Suffix = 0;
if(fileList.length){
Suffix = Number(fileList[0].name.replace(/\.[^\.]+$/, '').match(/\d+$/));
}
Suffix= zeroPad(Suffix + 1, 3);
var saveFile = File(savePath + "/" + Name + "_" + Suffix + ".psd");
SavePSD(saveFile);
}
function SavePSD(saveFile){
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
-
pierrerodrigue
Need help for script from a non-initiate
Thank's Paul MR
It seems to me to be a lot like what I was looking for. One question, in the first script, where is the place where I should put the permanent links to the directory I need?
It seems to me to be a lot like what I was looking for. One question, in the first script, where is the place where I should put the permanent links to the directory I need?