Adobe Script Tutorial 5 Photoshop Process Folder and Save JPEGs

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025
  • Part Five of the series we switch to Photoshop. Using the tutorial code developed so far, with a few adjustments it becomes a Photoshop script to open files in a folder and save all as JPEG to another folder.
    Get example code: www.marspremed...
    Visual Studio (VS) Code: code.visualstu...
    ExtendScript Debugger: marketplace.vi...
    How to install Illustrator scripts macOS: • Illustrator Scripts Ho...
    How to install Illustrator scripts Windows: • Illustrator Scripts Ho...
    How to install InDesign scripts macOS: • InDesign Scripts How t...
    How to install InDesign scripts Windows: • InDesign Scripts How t...
    How to install Photoshop scripts macOS: • Photoshop Scripts How ...
    How to install Photoshop scripts Windows: • Photoshop Scripts How ...
    More about installing scripts both macOS and Windows: www.marspremed...
    Other useful scripts for Adobe Creative Cloud applications: www.marspremed...
    EXTENDSCRIPT RESOURCES
    InDesign ExtendScript API
    www.indesignjs....
    Photoshop ExtendScript API
    www.indesignjs...
    Illustrator Scripting Guide
    ai-scripting.d...
    JavaScript Tools Guide
    extendscript.d...
    ScriptUI for dummies
    creativepro.co...
    (PDF) Adobe Creative Cloud JavaScript Tools Guide
    download.macro...
    (PDF) Illustrator CC Scripting Guide
    www.adobe.com/...
    (PDF) Illustrator CC Scripting Reference JavaScript
    wwwimages.adobe...
    (PDF) Illustrator Scripting Guide (2021)
    readthedocs.or...
    (PDF) Photoshop CC Scripting Guide (2013)
    wwwimages2.ado...
    (PDF) Photoshop Scripting Reference (2020)
    www.adobe.com/...
    JPEG file icon used in thumbnail created by iconixar - Flaticon - www.flaticon.c...

Комментарии • 54

  • @jeffp666
    @jeffp666 2 года назад +2

    I have been going through your tutorials the last few days. Very helpful. Thank you for making these.

    • @wc7
      @wc7  2 года назад

      You are welcome. Thanks for the feedback.

  • @techlander00
    @techlander00 Год назад +1

    Great job William, many thanks from Marco

  • @starbasha525
    @starbasha525 Год назад +1

    Thank u so much

    • @wc7
      @wc7  Год назад

      Glad it helps. Thanks for watching.

  • @Ranjithkumar-ph5rp
    @Ranjithkumar-ph5rp 2 года назад +2

    awesome works @William The way you explain is very clear keep doing more videos & keep Rocking 👏👍

    • @wc7
      @wc7  2 года назад +2

      Great, I'm glad you like it. I have #6 and #7 already finished, will be out in the coming weeks. More to come. Any subjects you would like covered let me know. All suggestions are welcome. Thank you for your support.

    • @Ranjithkumar-ph5rp
      @Ranjithkumar-ph5rp 2 года назад +2

      @@wc7 Waiting for your updates 6 & 7 😊. Yes I have a subject..Is it possible to filter the images by their names using scripts for example I have given 500 images to my client and they have filtered 250 out of them by sending me the file names in document/ spreadsheet . How can I filter them and select the images ? is possible in scripts?

    • @wc7
      @wc7  2 года назад +1

      @@Ranjithkumar-ph5rp We can solve that without a script. Just takes Excel and a batch file. Are you on Windows? I'm making a quick video now that shows how to do it.

    • @wc7
      @wc7  2 года назад +1

      @@Ranjithkumar-ph5rp Just posted a video showing how to do it on Windows. ruclips.net/video/SPTlzu3QIjY/видео.html

    • @Ranjithkumar-ph5rp
      @Ranjithkumar-ph5rp 2 года назад +2

      @@wc7 yes I use windows...sure i'm Waitingggg ☺

  • @nirphotoartjaiminbhavsar6782
    @nirphotoartjaiminbhavsar6782 2 года назад +3

    Thanks Nice sr

    • @wc7
      @wc7  2 года назад +1

      You're welcome. And I got the other script you sent. VERY enlightening. It uses a Photoshop feature I wasn't aware of. I will be in touch with a script you should like very much. And later, another episode in this series of how to write it. I am very grateful for your feedback. It's been wonderful.

    • @nirphotoartjaiminbhavsar6782
      @nirphotoartjaiminbhavsar6782 2 года назад +3

      @@wc7 I'm glad you understood me, listened to me and gave me the script thanks sr

    • @nirphotoartjaiminbhavsar6782
      @nirphotoartjaiminbhavsar6782 2 года назад +3

      I don't create scripts but I have a lot of ideas. I modify the script according to my need and finish my work

  • @BabyIbra
    @BabyIbra Год назад +1

    Thanks sir :) so useful :D

  • @kennethog6433
    @kennethog6433 Год назад +1

    Amazing tutorials. How do I save to source folder without selecting each ? I'm working on lots of subfolders and it is tedious to keep selectin each subfolder input and output.

    • @wc7
      @wc7  Год назад +1

      The tutorials I start with blank folder paths but these don't have have to be blank. The folder path can be hard-coded when the interface control is defined. For this tutorial (#5) for example, edit the line that defines the static text of the folder path:
      txtFolderInput = g.add("statictext", undefined, "/Path/To/The/Desired/Folder/Here", {
      truncate: "middle"
      });
      The third argument is the text to display. Make it a valid path and it's already set, no need to click the folder button unless you want something else. Same applies to the output folder.

    • @kennethog6433
      @kennethog6433 Год назад +1

      @@wc7 Thank you so much.

  • @bharamappabandak9226
    @bharamappabandak9226 2 года назад +1

    Nice sir😊👌👌👌

  • @thanhtung767
    @thanhtung767 Год назад

    thanks sir 😍 but I want to add a count of the number of exported image files and image files of the input folder, what code do I need to add? For example: A / B is displayed with the progress table (eg A is the number of files that have been output, B is the number of files in the input folder)

    • @wc7
      @wc7  Год назад +1

      The tutorial includes a progress bar. The number of files in the selected folder can be obtained by the array returned by the getFIles method. In the tutorial the result is assigned to the variable 'files'. So files.length is the length of the array, in other words, how many members in the array, how many files. If you want to track how many files are processed, create a variable 'count'. Start at zero, count = 0. Each time a file is processed, increment. count++; Then at the end look at the value of count. It's the number of files processed.

    • @thanhtung767
      @thanhtung767 Год назад

      @@wc7 Can you make a detailed video? because I'm newbie 😁 Thank sir

  • @PHIHUNG_S79
    @PHIHUNG_S79 2 года назад +1

    Can I have a sample please?

    • @wc7
      @wc7  2 года назад

      A sample of what? The code? Link is in the description. Or do you mean something else? Please clarify. Thanks.

  • @hamishhamilton6923
    @hamishhamilton6923 2 года назад +1

    Hi William, do you have any scripts that would put a file name on an image. I’m currently using one by JJ Mack, for photoshop. The problem I’m having is trying to change the font, currently it’s coded like this “ArialMT”, this displays the Arial font to the image, I would like to change this to display Source Code Variable - Regular. Would you know how this should be written in the script or how I can find correct way to type this?

    • @wc7
      @wc7  2 года назад +1

      The trick is you need to use the font's PostScript name. Open the script in a text editor and search for "ArialMT". You should find the line that sets the font. Most likely something like textItem.font = "ArialMT"; I don't have the font you're referring to but I do have "Source Code Pro" on my Windows workstation. That font, for example, the PostScript name is "SourceCodePro-Regular". Many times you can guess the PS font name but not always. To find font names I have a little script that helps. I set the "find" var to "Source Code" in the code. Anyone can edit the script to change what to search for. The script alerts each font that matches the find var (matches meaning it has the text in its name). Download here: www.marspremedia.com/download?asset=photoshop-get-font-postscript-name.zip

    • @hamishhamilton6923
      @hamishhamilton6923 2 года назад +1

      @@wc7 Amazing it worked, thank you so much. 🤓

    • @wc7
      @wc7  2 года назад +1

      @@hamishhamilton6923 Great. Your comment also gave me a new idea. I just put together a script that reads all the fonts and writes out a CSV file with the names and PostScript names for all. And I made it also work in Illustrator and InDesign. I'll make a video explaining it with a download link. Coming soon. Thanks for the feedback. Comments like yours always give me new ideas.

    • @hamishhamilton6923
      @hamishhamilton6923 2 года назад +1

      @@wc7 That sounds amazing, great idea!. I'm sure that will be very useful 🤓

    • @wc7
      @wc7  2 года назад

      An afterthought... you asked "put a file name on an image." Yes I have a script for that. Look at this and tell me if that's what you mean: ruclips.net/video/eluuL8PX6I8/видео.html

  • @joviion2040
    @joviion2040 2 года назад

    And is there any way to link C or C++ coding to photoshop?

    • @wc7
      @wc7  2 года назад

      developer.adobe.com/photoshop/uxp/ps_reference/media/advanced/cpp-pluginsdk/

  • @Ozveidt
    @Ozveidt 2 года назад

    Thank U but how to select subfolder please ? I put the subfolder with images in the folder but the script write 'its empty" , Thx U :).

    • @wc7
      @wc7  2 года назад +1

      There is not a simple answer to that. I will make a video explaining how to do it, which requires a function that calls itself (recursion) to gather the contents of the folder and also the contents of every folder inside the folder and inside every folder inside the folder. Down the rabbit hole, shall we say.
      For now refer to another of my scripts:
      www.marspremedia.com/software/photoshop/process-folder
      Download this script and open in your editor. This script has a function named "getFiles()". Copy that function to your script and call it instead of "Folder.getFiles()". Pass the folder parameter and "true" for the subfolder parameter and it gets files in subfolders also.

    • @Ozveidt
      @Ozveidt 2 года назад

      @@wc7 Thank U so much ♥ , its possible to add the file in photoshop but stored by name and not by folder like 1a in folder A and 1b in folder B (as 1a,1b etc) Please ? :)

    • @wc7
      @wc7  2 года назад +1

      @@Ozveidt Yes it's possible, but difficult to fully explain in a comment, but I'll try to set you in the right direction. When you "get files" using either method, the result is an array of file objects. Each has various properties. Here is a link to a reference of those properties:
      www.indesignjs.de/extendscriptAPI/photoshop-latest/#File.html
      The property you want is "path". This is where the file is stored -- the folder -- without the file name. Paths are separated by slashes (/). So the last segment, after the last slash, is the subfolder the file is in. You want only that, not the entire path, which is from the top level of the computer file system. Use a regular expression pull out only the last segment.
      var subfolderName = file.path.replace(/\/([^\/]+)$/, "$1");
      Then look at the tutorial 5 code, function processFile, line 122
      fileJpg = new File(txtFolderOutput.text + "/" + file.name.replace(/\.[^\.]*$/, "") + ".jpg");
      Instead of file.name.replace... etc. make your own file name based on the subfolder name, for example...
      var fileName = "1" + subfolderName;
      And replace that part of line 122 to look like this instead:
      fileJpg = new File(txtFolderOutput.text + "/" + fileName + ".jpg");
      That's roughly how to do it and should light the way, I hope.

    • @Ozveidt
      @Ozveidt 2 года назад +1

      @@wc7 Ok, i see thank U , i will check .
      U'r a good personne ♥

    • @wc7
      @wc7  2 года назад +1

      @@Ozveidt Thanks. I've added the topic to my list of future tutorials. Thank you for the suggestion. I'll combine how to deal with subfolders with how to use custom names when saving images. Should be another good tutorial video for the series.

  • @joviion2040
    @joviion2040 2 года назад

    how to find duplicate layers in photoshop and delete it.?

    • @wc7
      @wc7  2 года назад

      But what is a duplicate layer? Same name? That wouldn't be difficult, but same name doesn't guarantee same content. Completely different layers could have same name. Maybe that's all you mean. For same content, I imagine use blending mode difference one layer over another and look for any results. If none, I'd think they are the same content. Is that what you mean?

    • @joviion2040
      @joviion2040 2 года назад

      @@wc7 thank you for your reply.By mistake i sometimes copy layer names twice ,so to delete it ,how can i use the script?

    • @wc7
      @wc7  2 года назад

      @@joviion2040 I would be worried about using a script for this. How do we make sure not to delete wanted layers if only deleting layers of same name? It could be a dangerous script.

  • @PHIHUNG_S79
    @PHIHUNG_S79 2 года назад

    Can I have a sample please?

    • @wc7
      @wc7  2 года назад +1

      See response to duplicate question.