Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24
  1. #21
    The Script Master
    Join Date
    May 2009
    Location
    Bradford,UK
    Posts
    325
    Post Thanks / Likes
    Mentioned
    6 Post(s)
    Activity
    Points
    1,288
    Level
    12
    Lv. Percent
    23.65%
    Achievements Gaining PopularityQualified to FreelanceProfessional Poster
    Awards Scholar

    Re: Photoshop - Microsoft Excel Macro

    yes, or you could call another script from the same position I.E.
    Code:
    var SCRIPTS_FOLDER =  decodeURI(app.path + '/' + localize('$$$/ScriptingSupport/InstalledScripts=Presets/Scripts')); 
    $.evalFile( new File(SCRIPTS_FOLDER +  '/Name of your script.jsx'));

  2. #22
    Junior Member
    Join Date
    May 2017
    Posts
    12
    Post Thanks / Likes
    Mentioned
    0 Post(s)
    Activity
    Points
    59
    Level
    2
    Lv. Percent
    65.67%
    Achievements Sprout

    Re: Photoshop - Microsoft Excel Macro

    I know the reason why it is not working but I do not know a solution for it.

    The final action (that I asked how to do in the previous message) that needs to be ran is a batch process. It takes all of the files that have been produced in a folder, and usually we would go to File > Automate > Batch and select the folder and the action and run it. As this part is not included in the code for it, it is not running it and producing an error.

    Any ideas?

  3. #23
    The Script Master
    Join Date
    May 2009
    Location
    Bradford,UK
    Posts
    325
    Post Thanks / Likes
    Mentioned
    6 Post(s)
    Activity
    Points
    1,288
    Level
    12
    Lv. Percent
    23.65%
    Achievements Gaining PopularityQualified to FreelanceProfessional Poster
    Awards Scholar

    Re: Photoshop - Microsoft Excel Macro

    You could do all the resizes in the one script and all the saves, as an example.

    Code:
    #target photoshop;
    app.bringToFront();
    main();
    function main(){
    var inputFolder = Folder("/R/Marketing/Images/Batch Done");
    if(!inputFolder.exists) {
    alert("Input folder does not exist");
    return;
    }
    var outputFolder = Folder("/R/Marketing/Images/Batch To Go");
    if(!outputFolder.exists) outputFolder.create();
    var csv = File.openDialog("/R/Inventory/Test","CSV File:*.csv");
    if(csv == null) return;
    csv.open("r");
    csv.encoding = "UTF-8";
    var fileList = csv.read().split("\n");
    csv.close();
    //start at 1 to exclude header line. 0 if no header line
    for(var a = 1;a<fileList.length;a++){
    if(fileList[a].length < 3) continue;
    var line = fileList[a].split(",");
    var file = File(inputFolder + "/" + line[0].toString());
    if(!file.exists) continue;
    app.open(file);
    var doc = activeDocument;
    var res = doc.resolution;
    //amend to suit.
    doAction("Whole","Pair_Kit_Batch");
    var outFile = File(outputFolder + "/" + line[1].toString() + ".jpg");
    SaveJPEG(outFile, 8);
    /////////////////////////////////////////////////////////////////////
    //Set restore point
    var savedState = app.activeDocument.activeHistoryState;
    var outFile = File("/R/Marketing/Images/Batch Size1" + "/" + line[1].toString() + ".jpg");
    //resize document to 1024 pixels wide keeping constrain
    doc.resizeImage(new UnitValue(1024,'px'), undefined, res, ResampleMethod.BICUBIC);
    SaveJPEG(outFile, 8);
    //Restore back
    doc.activeHistoryState = savedState;
    /////////////////////////////////////////////////////////////////////
    //Set restore point
    var savedState = app.activeDocument.activeHistoryState;
    var outFile = File("/R/Marketing/Images/Batch Size2" + "/" + line[1].toString() + ".jpg");
    //resize document to 1000 pixels wide keeping constrain
    doc.resizeImage(new UnitValue(1000,'px'), undefined, res, ResampleMethod.BICUBIC);
    SaveJPEG(outFile, 8);
    //Restore back
    doc.activeHistoryState = savedState;
    /////////////////////////////////////////////////////////////////////
    //Set restore point
    var savedState = app.activeDocument.activeHistoryState;
    var outFile = File("/R/Marketing/Images/Batch Size3" + "/" + line[1].toString() + ".jpg");
    //resize document to 800 pixels wide keeping constrain
    doc.resizeImage(new UnitValue(800,'px'), undefined, res, ResampleMethod.BICUBIC);
    SaveJPEG(outFile, 8);
    //Restore back
    doc.activeHistoryState = savedState;
    /////////////////////////////////////////////////////////////////////
    //Set restore point
    var savedState = app.activeDocument.activeHistoryState;
    var outFile = File("/R/Marketing/Images/Batch Size4" + "/" + line[1].toString() + ".jpg");
    //resize document to 600 pixels wide keeping constrain
    doc.resizeImage(new UnitValue(600,'px'), undefined, res, ResampleMethod.BICUBIC);
    SaveJPEG(outFile, 8);
    //Restore back
    doc.activeHistoryState = savedState;
    /////////////////////////////////////////////////////////////////////
    //duplicate the block of code for as many times as required
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    }
    };
    function SaveJPEG(saveFile, jpegQuality){
    jpgSaveOptions = new JPEGSaveOptions();
    jpgSaveOptions.embedColorProfile = true;
    jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
    jpgSaveOptions.matte = MatteType.NONE;
    jpgSaveOptions.quality = jpegQuality;
    activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
    };

  4. Thanks DanEchelon clicked thanks for this post
    Likes DanEchelon liked this post
  5. #24
    Junior Member
    Join Date
    May 2017
    Posts
    12
    Post Thanks / Likes
    Mentioned
    0 Post(s)
    Activity
    Points
    59
    Level
    2
    Lv. Percent
    65.67%
    Achievements Sprout

    Re: Photoshop - Microsoft Excel Macro

    That is great Paul. Works very well. Thank you very much.

    Final thing (and I promise this time!), is for one of the versions of the resize batch that we run, we have in the action to "Place" a psd file over the image which has a watermark on it.

    The action looks like this:

    Place
    R:\Inventory\Images\Watermark\Watermark.psd
    Center: center
    Translate: 0cm 0cm

    Is there a way of incorporating the "Place" into one of these resizes as well?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Photoshop Gurus
Photoshop Gurus (PSG) is a friendly community of designers and artists who enjoy all things related to Photoshop. PSG can consider itself one of the oldest Photoshop sites and has recently had it's 10th anniversary. We've come a long way and have every intention to continue supporting the Photoshop community. Photoshop can be an overwhelming program for beginners and that's how we try to help. We have a friendly forum, tutorials and all resources to help you understand this wonderful program. Feel free to look around and if you have any questions, don't hesitate to ask. Happy browsing!