Copy link to clipboard
Copied
Hello personal greetings to all!
I have some images to be printed on some products ... For this I have to create a new document and add corresponding mascaras to size prints, then have to save these documents (backup) in the same folder of the last inserted picture. I have two questions:
1st: There is how to create a script to auto save the document?
2nd: Whenever I run this script in the same document, the same self rename. Example: document-01.jpeg .... document-02.jpeg ... document-03.jpeg ...
Already, I thank you for your help.
I'll leave some illustrations to better understand.
Copy link to clipboard
Copied
I see no product. You illustration seems to show a Composite image opened, a new document created to house two copies of the composite image rotated 90 degrees and positioned side by side and saved with some name you want. That process could be scripted.
Copy link to clipboard
Copied
That's right Mr. Jack! Printing via sublimatic paper.
Copy link to clipboard
Copied
This works for me..
#target photoshop
var folder_path = "~/desktop/something/";
// Change here the path to your fokler.
if (app.documents.length > 0){
app.activeDocument = app.documents[0];
var fold = new Folder(folder_path);
if (!fold.exists) fold.create();
var i = 0;
while (true){
f_name = folder_path + app.documents[0].name.slice(0,-4);
f = new File(f_name +"_"+i+".jpg");
if (!f.exists) break;
i++;
}
savePng(f_name+"_"+i);
}
function savePng(name){
var doc = app.activeDocument;
saveOptions = new JPEGSaveOptions;
var f = new File (name);
doc.saveAs (f, saveOptions, true);
}
Copy link to clipboard
Copied
Thank elyasafo28436183! Your script worked 50% sure, it saves copies perfectly ... It would work 100% if the document was saved in the folder where the file used in the document ... He always saved on the desktop. Is there a way to fix as my need.?
Copy link to clipboard
Copied
Of course..
edit the the 4th line to -
- var folder_path = app.activeDocument.path +'/';
Copy link to clipboard
Copied
I made the change and this message appears
Copy link to clipboard
Copied
The document has not yet been saved..
So the script don't know where to save the images..
Copy link to clipboard
Copied
If you create a new document, insert an image and then asked to save, it shows you the folder that image ..... This is not possible through script?
Copy link to clipboard
Copied
In my Photo Collage Toolkit package there is a script I wrote to populate a Multi Image collage psd template with a single image that will be populated into every image location in the Collage template and rotate images for best fit given the two aspect ratios. The Images aspect ratio and the Collage template image locations aspect ration. Fitted image look like centered corps. If Aspect ratios match no part of the image will be masked off. I created that script for Adobe has removed their Picture Package Plug-in from Photoshop. My script will work as a substitute for picture package however it requires a template and has higher overhead then Adobe Picture Package had.
So it would be easy to create a two image side by side collage pad template file. Then Batch populate the template with all your images.
Photo Collage Toolkit
Photoshop scripting is powerful and I believe this package demonstrates this A video showing a 5 image collage PSD template being populated with images:
The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.
There are fifteen scripts in this package they provide the following functions:
Copy link to clipboard
Copied
JJMack Thank you for your attention and for trying to help me, but not quite what I need.
Copy link to clipboard
Copied
If you download my toolkit and install it. All you need to do is create a Collage PSD template file. All it would need to have is a background layer that has a canvas size and resolution to house your two side be side images. There also need to be two alpha channels one to map each image shape size and location. Batch populate that template using item 12 above Script BatcPicturePackage.jsx
Copy link to clipboard
Copied
What I need is just a script that creates a backup of the document in the same folder as the arquvios.
http://pastebin.com/raw/eKDfnY5u
This script work fine, I just need to program for it to save in the same folder of images used.
You need not do anything, only resize the directory of the image used in the current document.
Copy link to clipboard
Copied
You can get that path from the active document,
Copy link to clipboard
Copied
When creating a new document after we insert a picture, to save the document, it directs you exactly to the folder containing the last entered file. The point is that I use a lot of images in several different folders. Manually it would be impossible. I would not have to automate this process?
Just as was automatically redirected to a folder on the desktop, it could be redimencionado "saved" in the same folder where the image used is located.
Copy link to clipboard
Copied
The script you posted has a hard codes output folder variable. You would set ths vaiiable dynamiclly when you start pricessing an input image. You would get its file path and set the output folder variable.
Copy link to clipboard
Copied
Hi Mauricior,
Run this code and this script will ask for folder to proceed JPG conversion.
After ran, the final file saved into same folder with name of "JPG" under folder
Try this code..
#target Photoshop
main();
function main(){
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
app.displayDialogs = DialogModes.NO;
var myFolder = Folder.selectDialog ("Select Source Folder to Proceed!");
if(!myFolder){return;}
var myFiles = myFolder.getFiles(/\.(jpg|tif|eps|psd)$/i);
if(myFiles.length==0){alert("No files to use this folder!"); return;}
for(var i = 0; i < myFiles.length; i++){
var docRef=app.open(myFiles);
var docPath=myFiles.path;
var dname=myFiles.name;
fileName=decodeURI(dname).replace(/\.[^\.]+$/, '');
Ext=(i<10) ? "0"+ (i+1) : (i+1);
fileName=fileName+"_Porcelana_print_"+Ext;
OutFoldJPG(docPath+"/JPG",fileName,12,true,Extension.LOWERCASE);
docRef.close(SaveOptions.DONOTSAVECHANGES);
};
}
function OutFoldJPG(docPath,dnme,jpegQuality,cProfile,formatType,fCase){
var outfolder = new Folder(docPath)
if (outfolder.exists == false){
outfolder.create();
var saveFile = new File(outfolder + "/" + dnme);
SaveJPEG(saveFile,jpegQuality,cProfile,fCase);
}
else{
var saveFile = new File(outfolder + "/" + dnme);
SaveJPEG(saveFile,jpegQuality,cProfile,fCase);
}
}
function SaveJPEG(saveFile, jpegQuality,cProfile,fCase){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = cProfile;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE
jpgSaveOptions.quality = jpegQuality; //1-12
activeDocument.saveAs(saveFile, jpgSaveOptions, true,fCase);
}
-yajiv
Copy link to clipboard
Copied
Hello Natrev, thank you for the help! Your script is very good and will I be very useful in other jobs.
What I need is just a script que Creates a backup of the document in the same folder of the arquvios.
http://pastebin.com/raw/eKDfnY5u
This script works well, the problem is that it does not save in the same folder as the image used in the current document. Thank you!
If you can test this script, you'll see that it actually works but the backup is created on the desktop.
Copy link to clipboard
Copied
Hi Mauricior,
Change the 18th line code
OutFoldJPG(docPath+"/JPG",fileName,12,true,Extension.LOWERCASE);
to this line
OutFoldJPG(docPath,fileName,12,true,Extension.LOWERCASE);
Its save the file with in same native folder.
cheers...
-yajiv
Copy link to clipboard
Copied
Hello guys, I want to thank everyone who tried to help me .... Thank you for your attention. Unfortunately I did not get the expected result. I thought it best to take a break in this matter. A hugs to everyone.