Skip to main content
Participating Frequently
September 17, 2020
Answered

Droplet with prefix in original folder

  • September 17, 2020
  • 1 reply
  • 1518 views

Hello,

I would like to create a droplet to change the size of the image but also to save the new file with a prefix.

picture.jpg> droplet> size change> save file change with the WEB- prefix.

picture.jpg (original)
WEB-picture.jpg (size changed)

I would like this file to be saved in the original folder and not in a fixed folder.

The pb is that to integrate a fixed prefix, I need, in the droplat option, to choose a folder.

Do you know if I can get around this restriction?

thank you so much

This topic has been closed for replies.
Correct answer c.pfaffenbichler

Indeed, I understand better now. I'm almost there, I integrated the script into an action that I would convert to a droplet afterwards.
On the other hand, I have a pb is that it asks me at the end of the action when I want to close the image if I want to save the changes.
Knowing that this is the original I do not want it. I think the easiest way would be to add the size modification directly in the script?
1500px wide 72 dpi


try this

// save 1500px wide jpg;
// 2020, use it at your own risk;
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
try {
var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var thePath = myDocument.path;
}
catch (e) {
var theName = myDocument.name;
var thePath = "~/Desktop"
};
var thePrefix = "web";
// duplicate;
var myDocument = app.activeDocument.duplicate("theCopy", true);
myDocument.resizeImage(new UnitValue (1500, "px"), undefined, 72, ResampleMethod.AUTOMATIC);
// jpg options;
var jpgopts = new JPEGSaveOptions();
jpgopts.embedProfile = true;
jpgopts.formatOptions = FormatOptions.STANDARDBASELINE;
jpgopts.matte = MatteType.NONE;
jpgopts.quality = 10;
myDocument.saveAs((new File(thePath+"/"+thePrefix+"_"+theName+".jpg")),jpgopts,true);
// close;
myDocument.close(SaveOptions.DONOTSAVECHANGES)
};

1 reply

c.pfaffenbichler
Community Expert
Community Expert
September 17, 2020

A Script could handle the save-in-same-location-with-amended-name and the resizing, hhow omprtant is the droplet-aspect to you? (Though including a Script in an Action is possible anyway.)

Participating Frequently
September 17, 2020

Thank you for your reply.
The droplet is important because it will be used between 50 to 100 times a day by my entire team.
I am a newspaper iconographer and we need to provide 2 photos for each article. 1 file which will be converted into cmyk and 1 web file for the site.

I will look for the scripts, but it seems to me much more complicated than the actions ...

Thank you

Participating Frequently
September 17, 2020

The scaling could be included in the Script but the question is how far you want to go into Scripting. 

 

As it is the Script in an Action that first uses File > Automate > Fit Image should work fine in a Droplet. 

You would need to »install« the Script on all your colleagues’ computers, too, naturally if they use the droplet.  

 

But if you want to compund the whole process (including separating and saving the second, CMYK image) into one script it might also be useful to apply a Keyboard Shortcut to the Script and trigger it that way. 

But it depends on how you are likely to use it – one image at a time or a bunch of images at a time (especially if they are not open yet the droplet might still seem advantageous)? 

 


The ideal would be to be able to drag & drop the photo on the droplet and have it done automatically, with the photo closed at the end.
The goal for me being that it is the simplest and the most transparent for my team.