• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Automated Filename Default Types/Tags?

Engaged ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Hi Everybody,

 

Does Photoshop have attribute tags internally that can be signaled from the filename? 

 

Like I work in ad production and commonly have to do builds that are massive and involve renaming and renaming over and over again due to file width and height.

 

Is there something where Photohshop has the ability to automatically Save As the width and height into the filename?

 

Like, is it possible to Save As and enter int something that's likes ProjectName_$width_x_$height.png and it saves the width and height into the filename (like batching)? 

 

Is something like that available? If so, I think I'd dance like Carlton from Fresh Prince. 

 

Thanks for any suggestions. 🙂

 

 

 

 

TOPICS
Actions and scripting , macOS

Views

339

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Yes this is possible using scripts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Right, but is that possible without running a batch? Does Photoshop have the ability to reformat...

Project_$width_x_$height.psd into Project_1200x800.jpg

 

...by just keeping your files with cetain variables in their filename and upon Save For Web or something it recognizes these values and converts them? My work is too custom to batch (That's why I have a job 🙂 I have to work on these one at a time. 

 

Is there an internal function or plugin/add-on that can create that functionality juse within Save As?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

I don't know that Photoshop can do that. But as mentioned this could be scripted. I bet you can get this done relatively inexpensively on somewhere like UpWork. I can recommend someone if you'd like. 

AMD Ryzen 5 5600G with Radeon Graphics 3.90 GHz<br />ASUS ROG STRIX B450-F GAMING II AM4 AMD B450 Motherboard<br />32GB DDR4 3600 RAM<br />NVIDIA GeForce GTX 1080<br />EIZO ColorEdge CG275W<br />EIZO ColorEdge CG277<br />Windows 10 Pro>--<br />AMD Ryzen 5 5600G with Radeon Graphics 3.90 GHz<br />ASUS ROG STRIX B450-F GAMING II AM4 AMD B450 Motherboard<br />32GB DDR4 3600 RAM<br />NVIDIA GeForce GTX 1080<br />EIZO ColorEdge CG275W<br />EIZO ColorEdge CG277<br />Windows 10 Pro

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Not a bad idea. If I could 'upgrade' my Photoshop to do that somehow using an add-on that had a list of terms that automated naming that'd be pretty hot. Not sure I have the bandwidth yet, but it's something to keep in mind though. Thanks! 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2022 Jul 04, 2022

Copy link to clipboard

Copied

Yes, this can be scripted without batching.

 

Three choices:

 

1) Dupe doc with new desired name

 

2) Save as or save as a copy with new desired name (or legacy save for web export)

 

3) Rename layer with desired filename for use with Generator/Assets

 

Edit: Here is a simple proof of concept script, it will Save As a Copy the currently open file to the document path, adding the required width and height into the filename while presenting the standard OS dialog window allowing you to select the save location and file format as required. Unsaved files will offer a dialog to set the save path.

 

It is easy enough to change this to use Export > Save for Web (Legacy) and possibly other things as required.

 

#target photoshop

if (app.documents.length) {

    try {
        // Use the previously saved directory path
        var p = activeDocument.path;
    } catch (e) {
        // If unsaved, prompt for the save path
        var p = Folder.selectDialog('Unsaved file, select the save directory:');
    }

    var d = activeDocument.name.replace(/\.[^\.]+$/, '');
    var w = activeDocument.width.value;
    var h = activeDocument.height.value;

    customNameSave(new File(p + '/' + d + '_' + w + 'x' + h + '.psd'), true);

    function customNameSave(saveIn, copy) {
        var s2t = function (s) {
            return app.stringIDToTypeID(s);
        };
        var descriptor = new ActionDescriptor();
        var descriptor2 = new ActionDescriptor();
        descriptor2.putBoolean(s2t("maximizeCompatibility"), true);
        descriptor.putObject(s2t("as"), s2t("photoshop35Format"), descriptor2);
        descriptor.putPath(s2t("in"), saveIn);
        // Set to false to Save As rather than Save As a Copy
        descriptor.putBoolean(s2t("copy"), copy);
        descriptor.putBoolean(s2t("lowerCase"), true);
        executeAction(s2t("save"), descriptor, DialogModes.ALL);
    }

} else {
    alert('You must have a document open!');
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

Yeah, but I need a variable for the file size (width/height) in the filename. I've got a myriad of widths and heights saving and cataloging all those measurements is really not...the directive (if I'm understanding your suggestion correctly). 

 

Like, I don't want to template sizes and then select them. Also, I can't save sizes by layers/export UNLESS the variable is in the layer name. If that's the case, then I might be able to use a template 'prototype' set with the layers already labeled by width/height if the layer name = the filename. As we use the same 'spec' sets for delivery depending on whether it's Youtube, Redbox, etc.   

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

@Stephen_A_Marsh  - Sorry, I just now saw the script after I responded. I'll take a look at that first. Thanks!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied


@Gotta Dance wrote:

Yeah, but I need a variable for the file size (width/height) in the filename.

 

That was understood. AFAIK there are four places where a new document name can be created, as one can't change the name of a document open in Photoshop until that doc is closed.

 

So to create derivative files that add the current document's width and height pixel values, one has to pick one of these options which can all be scripted:

 

(1) Duplicating the current file

(2) Saving the current file

(3) From the layer name when using Generator

(4) Renaming a file on-disk

 

The proof of concept script that I posted does this using option (2) above. Just let me know the Save for Web options that you wish to use, a screenshot of the Save for Web interface when saving would be helpful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied


@Stephen_A_Marsh wrote:

... as one can't change the name of a document open in Photoshop until that doc is closed.


 

Your script is (once again) brilliant, Stephen, and what I'm about to say has nothing to do with your script.

 

I just want to mention that not being able to change the name of a document while it's open is Windows-only. On Macs the document can be renamed, copied, moved, and deleted while it is open.

 

Cheers,

Jane

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied


@jane-e wrote:

@Stephen_A_Marsh wrote:

... as one can't change the name of a document open in Photoshop until that doc is closed.


 

Your script is (once again) brilliant, Stephen, and what I'm about to say has nothing to do with your script.

 

I just want to mention that not being able to change the name of a document while it's open is Windows-only. On Macs the document can be renamed, copied, moved, and deleted while it is open.

 

Cheers,

Jane


 

Thanks Jane, do you mean within Photoshop, or at the Finder level? The context of my comments was within Photoshop scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

@Stephen_A_Marsh wrote:

 

"... as one can't change the name of a document open in Photoshop until that doc is closed." 

 

"Thanks Jane, do you mean within Photoshop, or at the Finder level? The context of my comments was within Photoshop scripting." 

 

I think I'm confused by your question, Stephen?

 

Jane

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

You mentioned that it was possible to rename, delete etc. a file that is open in Photoshop. Is the rename or delete being performed in the Finder, Terminal or Photoshop?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

LATEST

 

How do you delete or rename a file from within the Photoshop application? And if you do, is it not also renamed in Finder/Windows File Explorer, Bridge, et cetera?

 

Jane

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

A few years ago, I wrote a script to solve a similar problem: the script is written in action instead of the save as command and, in the process, forms the name of a directory or file according to the rules specified by user.

2022-07-06_13-54-30.png

The only negative is that I used only 3 formats for saving: jpg, psd, tiff. Perhaps someday I will rewrite it, but if you wish, you can add the desired format to the code yourself.

 

link on github: smart save 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

We had a jsx script built for us that does this in Photoshop and Finder/Explorer and works like a charm. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines