I need a script to perform a specific action and save file with the SAME name of document .jpg

I have all my PSD master files registered as follows: mydocument_PSD.psd. I want to run a custom action to sharpening and then save the file as mydocument.jpg (note the part "_PSD" should be removed).

I found this Photoshop-export-PSD-script/Export - PSD.jsx to edwardloveall/Photoshop-export-PSD-script master · · GitHub that gets me close to there, but that's a png and is the name of the document to the right and there is no action ran.

Any ideas?

This gives a try...

#target photoshop;   

main();
function main(){
if(!documents.length) return;
try{
    var path = activeDocument.path;
    }catch(e){
        alert("This document has not been saved");
        return;
        }
if(activeDocument.name.toString().toLowerCase().search(/_psd\.psd$/) == -1){
    alert("Filename is not in the correct format");
    return;
    }
var fileName = activeDocument.name.toString().match(/[^_]*/);
var savedState = activeDocument.activeHistoryState;
doAction("savelarge","Action Set");
//////////////////////////////////////////////////////////////////////
SaveJPEG(File(path + "/" + fileName + "_large.jpg"),10);
activeDocument.activeHistoryState = savedState;
savedState = activeDocument.activeHistoryState;
doAction("savesmall","Action Set");
//////////////////////////////////////////////////////////////////////
SaveJPEG(File(path + "/" + fileName + "_small.jpg"),10);
activeDocument.activeHistoryState = savedState;
};
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);
};

Tags: Photoshop

Similar Questions

  • Help! Need a script to automatically open files with the same name but in another location.

    Good morning friends,

    So for my work, I need a script to open files with the same name but located in a different folder. But since I'm a total noob when it comes to programming, I can't understand how do. That's what I have in mind:

    -J' I manually open an image.

    -The script will look for a file with the same name in another folder that I've specified.

    -The script will then select the channel CMYK of the second file and copy and paste it into the first file.

    -The second file is then closed without saving the changes.

    I have problems with the part where the script searches for a file with the same name as the opened file. I would really appreciate help. Thanks in advance.

    If (app.documents.length > 0) {}

    myDocument var = app.activeDocument;

    var Nomdoc = myDocument.name;

    try {var basename = docName.match (/(.*)-.)} [ ^\.] +$/)[1]}

    catch (e) {var basename = thedoc.name};

    var path = / * path of folder to insert as a string here * / + ' / ' + base name + / * insert file extension, including the period as a string here * /;

    If (queue (path) .exists == true) {var otherDocument = app.open (File (path))};

    };

  • I want to buy an iBook. There are 2 different books with the same name, author, and the book cover. They are different number of pages with different prices. Specifically, all the light that we do not see. " How do you know that we purchase?

    I want to buy an iBook. There are 2 different books with the same name, author, and the book cover. They are different number of pages with different prices. Specifically, all the light that we do not see. " How do you know that we purchase?

    I would get one that has 4700 comments already.

  • I want to move virtual machines to a folder called Linux name, but we have several file of the same name in our Datacenter, please give me PowerCLI Script to move exactly

    I want to move virtual machines to a folder called Linux name, but we have several file of the same name in our Datacenter, please give me PowerCLI Script to move exactly.

    I tried to use for the function FolderByPath below, but don't know how to use it and have worked. Please help me in this.

    Function Get-FolderByPath {}

    < #.

    . Records of recovery SYNOPSIS by giving a path

    . DESCRIPTION the function will retrieve a record by its

    path. The path can contain any type of leave (folder or)

    Data Center).

    . Author NOTES: Luc relaxing

    . Path PARAMETER

    The path to the folder.

    This is a required parameter.

    . Path PARAMETER

    The path to the folder.

    This is a required parameter.

    . PARAMETER separator

    The character used to separate the leaves in the

    path. The default value is ' / '.

    . EXAMPLE OF

    PS > Get-FolderByPath-path ' Datacenter/Folder1/Folder2 ".

    . EXAMPLE OF

    PS > Get-FolderByPath-path "Folder1 > Folder2"-separator ' > '

    # >

    (param

    [CmdletBinding()]

    [parameter (Mandatory = $true)]

    [System.String []] ${Path}.

    [tank] ${delimiter} = ' / '.

    )

    {in process

    If (((Get-PowerCLIConfiguration).)) DefaultVIServerMode - eq "Multiple") {}

    $vcs = $defaultVIServers

    }

    else {}

    $vcs = $defaultVIServers [0]

    }

    {foreach ($vc to $vcs)

    {foreach ($strPath in $Path)

    $root = get-file-name of the server data $vc centers

    $strPath.Split ($Separator) | %{

    $root = get-inventory-name $_-location $root - server $vc - NoRecursion

    If ((Get-stocks-localisation $root-NoRecursion |)) Select--ExpandProperty name)-contains "vm") {}

    $root = get-inventory-name "vm" - location $root - server $vc - NoRecursion

    }

    }

    $root | where {$_-is [VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl]}|% {}}

    Get-file-name $_. Name - location $root. Parent - Server $vc

    }

    }

    }

    }

    }

    You can try to retrieve the object file by steps as well.

    Something like this for example

    $folder = get-data center-name 'LTX01-G8 | Get-file-name "LTX-servers | Get-file-name "LTX servers 0000 - 0299. Get-file-name Linux

    I guess the first qualification in your path was the data center.

  • Create a script to list all the .bat and .cmd files with the dir command &

    Hello

    Im trying to create a script that will list all the .bat and .cmd files in a specific folder and add the data to a new file (file.txt) - example below:

    dir c:\>desktop\file.txt/OD
    dir d:\>>desktop\file.txt
    dir f:\jobs\*.bat>>desktop\file.txt/OD

    IM able to search the F drive and the list of all the .bat files using a generic parameter, but ideally id like to search for .bat and .cmd files, but whenever I have it try does not work. Any ideas?

    I tried the following:

    dir c:\>desktop\file.txt/OD
    dir d:\>>desktop\file.txt
    dir f:\jobs\*.bat,*.cmd>>desktop\file.txt/OD

    Any help is appreciated, the reason for which I need to check all the .bat and .cmd files is to ensure that the scripts on a cluster are all data, so need them all listed in a doc if possible

    Thank you

    Hello

    Thank you for visiting the Microsoft answers community site. Your question of Windows 7 is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for guys official script Forum. Please ask your question in the official Scripting Guys Forum.

    http://social.technet.Microsoft.com/forums/en-us/iTCG/threads

  • I can't receive e-mail of 1 specific address and this address has the same problem with mine.

    It is a problem with Thunderbird. I can email on the web client, but not through thunderbird for this one specific address.

    whcorgan said

    Nevermind, I fixed it. For some reason, my email address was considered undesirable. I had to go and change the filter of junk mail with my ISP. Thunderbird not having a junk e-mail folder, I didn't know what was going on until I signed my web mail.

    Thunderbird gets all messages if you use IMAP. If you are using pop, you get what's in the Inbox. This limitation is based on the Protocol of messaging of your choice. Even if your email provider may be in ages dark and offer only pop. But they would be in a very small minority, if that were the case.

  • I need to work with a new company online, they need to firefox. Can I use firefox and ie 8 on the same computer?

    simple Yes or no

    Yes, you can use them at the same time if you wish.

  • Java Script to perform a different Action based on the Orientation of the Image

    I need help creating a Java Script to perform a different action based on image orientation landscape vs. portrait. Can someone help me in this task.

    Thank you

    The Wookiee

    That should do it.

    docRef = app.activeDocument;

    If (docRef.width > docRef.height) doAction ("Action of landscape", "action group '");

    another action ('Portrait Action', 'Action Group');

  • I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. Help

    I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. HELP PLEASE. previous e-mail files are under mail then mail.earthlink* .net and each of the five mail .net is an email address I have. I can't find a way to identify each file by email to the specific email address (IE mail.my E-mail name.net) so I can copy the files and emails from the past to the email addresses now under tbird. previous installed e-mail identities may not be the current configuration of e-mail files in tbird. I think that I must be sure that mail.name.net matches the previous mail.name.net to be able to copy and paste the old to the new. is there a way to find the file name correct the old email and correspond to the new? all my emails very important information are mostly in the old mail electronic id and must be available in the identification of email again (but same) how can I do this?

    http://KB.mozillazine.org/Importing_folders

    Use this module.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

  • How to launch two executable files (excel file & a .exe file) at the same time using VB Script?

    Hello

    I need vb Script code to run exe files at the same time.

    I hope someone will help me!

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

  • do action of photoshop which saves the file with the specific file name

    Is there a way to make a photoshop action that makes a SaveForWeb, but adds text in the name of the original file when recording?

    By example, if I open a file called "guard page", and I want the action of making SaveForWeb in JPEG format, can I save as "coverPageWEBVERSION"?

    Thank you for your time and help

    No it's something, for that you will need for scripting.

    They really should introduced some changes to the dialog box Save that allows additions or of the changes can be triggered again in the actions of file naming. But they never have.

    As a solution, bridge is a good tool to rename, because there is naming can be SAVED and quickly applied to groups of files. Done - on a mac it is not often known are also the scripts OS can do the same thing. There is a script called "rename the items' hidden somewhere. It is accessible through the control or right-click on a group of files and going through the submenu "automate".

  • Hello everyone! I need an application where I can hand write or type and draw, all in the same...

    Hello everyone! I need an application where I can hand write or type and draw, all on the same page,.

    I'm taking courses in biology and chemistry and sometimes I need to draw and explain

    Can someone help me?

    Thank you!

    I need an application where I can hand write or type and draw, all on the same page, I'm taking courses in biology and chemistry and sometimes I need to draw and explain

    @manuelito.castro,.

    Discover the "Mobilenoter" application, that includes the possibility of ink in free form. If you need to be able to classify and organize your writings, Mobilnoter works perfectly with a single Note.

    -Doc

  • I've been trying to get out of my printer and scanner works with the features, it can handle but you need the orginal software cd you can down line load a copy _ @ _. ___

    How can I get a copy of the cd that will work with your old software. I've been trying to get out of my printer and scanner works with the features, it can handle but you need the orginal software cd you can down line load a copy to * address email is removed from the privacy *

    Hi Oscar,.

    Thanks for the post.

    It seems you are trying to download the application printer and scanner. Please answer the following questions, which will help us to guide you in the right direction.

    1. What is the brand and model of the printer?

    Suggestions for a question on the help forums

    http://support.Microsoft.com/kb/555375

    Send us more information to help you better, we will be happy to help you!

  • Export PNG with the correct name, for each layer, script file frame foreach

    Hello guys,.

    I am trying to find a script that exports each separately from the layer in PNG, for each image, with the correct name. By example, if the layer is named snail and lies in a forest of group name and is like 6, export this layer as a PNG named forest.snail.06.png (recursion if possible) and this for each layer, for each image...

    I found a software named Layerex, they speak here about layers export Flash | Global Facilitation network

    But I could not find... If you guys know how to do, it would be so awesome...

    Take care

    Simon

    Using jsfl.

  • I work in a sensitive project where I have a specific slide which will not move forward. I created a click box that goes to the next slide, and it remains in the same blade if it is in a loop. Very strange. What might be missing?

    I work in a sensitive project where I have a specific slide which will not move forward. I created a click box that goes to the next slide, and it remains in the same blade if it is in a loop. Very strange. What might be missing?

    You can check the Advanced Interaction Panel? You have a note attached to the interactive objects in the simulation? If so, check the desired option Quiz, more specific preferences.

Maybe you are looking for