Combine "Save As" with suffix for file's name

I have 600x600px file named "ABC". I want to save this file in three versions within 1 folder which different to original folder:
ver1   600x600px   name  ABC_1  in JPEG
ver2   300x300px   name  ABC_2  in PSD
ver 3  300x300px   name ABC_3   in JPEG.
I can do this with Save As command but cannot add suffix.  I can add suffix with a script but I dont know how to create a UI interface to choose file type and file address like we do with Save As . Thanks in advanced for your script's  help .

Try this:
#target photoshop  
app.preferences.rulerUnits = Units.PIXELS;    
var targetFolder = new Folder('/c/');
var saveFolder = new Folder('/c/');
var docRef;
var jpgOptions = new JPEGSaveOptions();
jpgOptions.quality = 10;
var psdOptions = new PhotoshopSaveOptions();
psdOptions.layers = true;    
var winFiles = app.windowsFileTypes;
var macFiles = app.macintoshFileTypes;
var dlg = new Window('dialog','Process Images');
    dlg.targetGp = dlg.add('group');
    dlg.targetGp.sTxt = dlg.targetGp.add('statictext',undefined,'Target Folder');
    dlg.targetGp.btn = dlg.targetGp.add('button',undefined,targetFolder.fsName);
        dlg.targetGp.btn.size = [500,20];
        dlg.targetGp.btn.onClick = function(){
            targetFolder = Folder.selectDialog ('Select a target folder');
            dlg.targetGp.btn.text = targetFolder.fsName;}
    dlg.folderGp = dlg.add('group');
    dlg.folderGp.sTxt = dlg.folderGp.add('statictext',undefined,'Save Folder');
    dlg.folderGp.btn = dlg.folderGp.add('button',undefined,saveFolder.fsName);
        dlg.folderGp.btn.size = [500,20];
        dlg.folderGp.btn.onClick = function(){
            saveFolder = Folder.selectDialog ('Select a save folder')
            dlg.folderGp.btn.text = saveFolder.fsName};
    dlg.btnGp = dlg.add('group');
    dlg.btnGp.okay = dlg.btnGp.add('button',undefined,'Okay');
    dlg.btnGp.cancel = dlg.btnGp.add('button',undefined,'Cancel');    
    dlg.btnGp.okay.onClick = function(){
        if(!targetFolder.exists){alert('The target folder selected does not exist.')}
        if(!saveFolder.exists){alert('The save folder selected does not exist.')}
        if(targetFolder.exists && saveFolder.exists){
            dlg.close();
            runProg()}
    dlg.btnGp.cancel.onClick = function(){
        dlg.close()};    
    dlg.show();
function runProg (){
    var fileList = targetFolder.getFiles ()
    var filesToUse = new Array()
    for (var i=0;i<fileList.length;i++){
        if(IsFileOneOfThese( fileList[i], winFiles )){filesToUse.push(fileList[i])}
        else if(IsFileOneOfTheseTypes( fileList[i], macFiles )){filesToUse.push(fileList[i])}
        };//end loop 1
    for (var i=0;i<filesToUse.length;i++){   
        try{
             docRef = open(filesToUse[i]);
             var fileName = docRef.name.split('.')[0];
             var docSize = Math.max(docRef.width,docRef.height);
             if(docRef.width>docRef.height){docRef.resizeImage(600, undefined, undefined)}
             else{docRef.resizeImage(undefined, 600, undefined)};
             docRef.saveAs (new File(saveFolder+'/' + fileName + '_1.jpg'), jpgOptions);
             if(docRef.width>docRef.height){docRef.resizeImage(300, undefined, undefined)}
             else{docRef.resizeImage(undefined, 300, undefined)};
             docRef.saveAs (new File(saveFolder+'/' + fileName + '_2.psd'), psdOptions);
             docRef.saveAs (new File(saveFolder+'/' + fileName + '_3.jpg'), jpgOptions);
             docRef.close(SaveOptions.DONOTSAVECHANGES);
          catch(e){}
        };//end loop 2
function IsFileOneOfThese( inFileName, inArrayOfFileExtensions ) {
    var lastDot = inFileName.toString().lastIndexOf( "." );
    if ( lastDot == -1 ) {
        return false;
    var strLength = inFileName.toString().length;
    var extension = inFileName.toString().substr( lastDot + 1, strLength - lastDot );
    extension = extension.toUpperCase();
    for (var i = 0; i < inArrayOfFileExtensions.length; i++ ) {
        if ( extension == inArrayOfFileExtensions[i] ) {
            return true;
    return false;
// given a file name and a list of types
// determine if this file is one of the provided types. Always returns false on platforms other than Mac.
function IsFileOneOfTheseTypes( inFileName, inArrayOfFileTypes ) {
    if ( ! IsMacintoshOS() ) {
        return false;
    var file = new File (inFileName);
    for (var i = 0; i < inArrayOfFileTypes.length; i++ ) {
        if ( file.type == inArrayOfFileTypes[i] ) {
            return true;
    return false;
function IsWindowsOS() {
    if ( $.os.search(/windows/i) != -1 ) {
        return true;
    } else {
        return false;
function IsMacintoshOS() {
    if ( $.os.search(/macintosh/i) != -1 ) {
        return true;
    } else {
        return false;

Similar Messages

  • Acrobat 9.3.4 (or 9.3.3.177): Save As with Optimize for Fast Web View

    When I do a Save As with Optimize For Fast Web View checked, the saving stops and an Adobe Acrobat dialog displays:
         The document could not be saved. There was a problem reading this document (111).
    If I uncheck Optimize For Fast Web View, the Save As seems to work.
    Is there a way to have Fast Web View work with Save As?
    Acrobat.exe is version 9.3.4 (or 9.3.3.177 in the properties). The Acrobat.DLL version is 9.3.4.218.

    Thanks.  I did submit a report at the site.  I hope somebody reads it as this is a big problem for us.
    Thanks again.

  • Truly dumb question. How do I get PS to actually complete a command, eg straighten an horizon, and finalise the change. Even doing a "save as" with a new file name and reloading brings the image back, straightened, but with the skewed back ground frame st

    Truly dumb question. How do I get PS to actually complete a command, eg straighten an horizon, and finalise the change. Even doing a "save as" with a new file name and reloading brings the image back, straightened, but with the skewed back ground frame still there. Is there a "apply change" or similiar command that I simply cannot see.

    brings the image back, straightened, but with the skewed back ground frame
    PSE did what you told it to do. Choose the Straighten and crop edges or fill edges options when you use the straighten tool if you want it to do more than just straighten the contents of the image. Many people prefer the plain straighten because they'd rather crop themselves than let PSE do it.

  • How to save pictures with the config file "Write Key.vi"

    hi all,
    On my front panel I've few controls pictures containing photos (JPG type) . The user can select the photo he wants using the classic file dialog box.
    Usally I use the config files VI's to save the control values from one run to another one. In the config files VIs, I use the polymorphic "write Key.vi" wich accept only booean, I32, U32, path, and string dada type, but no picture !
    I've tried the "flatten to string" fonction (picture --> flatten to string --> writekey.vi) , no broken wire but the conversion is very very too long and to heavy (20Mo a key!).
    another way, would be to write in a xml file, I've also tried but I've always get the 1104 error: No end tag was found for an XML start/end tag pair.
    can someone help me.
    what is the best way for  retrieving controls pictures with photos

    Hi GerdW
    Many thanks for your quick answer. Always happy to get advises from fellow programmers.
    You suggest to use the "path" input of the "write key.vi" (configuration file utilities) to retrieve photos that a user would have selected in a previous run. Could be a good solution in a number of applications but what I would like to do is like in a excel or word file. Once a photo has been embeded in one xls file for ex., I find it back each time i open this xls file, even if the original photo's file has been deleted or if my application runs on another computer.
    xml file looks interesting for that purpose (i mean used as config file). I can easily store in a xml file a labview picture (like a colored rectangle e.g.) but when i try with a photo (wich is a also a picture) labview returns always the error 1104.
    How to fixe this error, or maybe  there is another way to store photos in a config file without passing through xml,
    kind regards.

  • Anyone use Flex with php for file upload? PHP Notice:  Undefined index:  Filedata

    My code works. It uploads the file and inputs the file name into a database, but I can't shake this php notice. I think php is looking for multipart/form-data from the HTML form tag.
    <form action="upload.php"  enctype="multipart/form-data"/>
    But I am using flex. The multipart/form-data info is sent as the second default argument of the upload() function. Does anyone have experience with this? Thanks.
    PHP Notice:  Undefined index:  Filedata
    $filename = $_FILES['Filedata']['name'];
    public function selectHandler(event:Event):void {
                    request = new URLRequest(UPLOAD_DIR);
                    try {
                        fileRef.upload(request);
                        textarea1.text = "Uploading " + fileRef.name + "...";
                    catch (error:Error) {
                        trace("Unable to upload file.");
                        textarea1.text += "\nUnable to upload file.";

    Hi, Thanks for your reply !
    Im not getting any errors Flex side, as i say i get a alert message saying the file has been uploaded so . .
    I am using a Wamp server on a windows machine, how do i check the file permissions on both the folder and the php file ?
    Also how do i debug a php file ?
    ANy help would be thankful !

  • Help with HttpClient for file download

    I am writing a class to download files from a website.
    The site gave me a user name and password for login
    I need to write codes to login automatically using the userName and password the site gave me.
    Please I need some help on how to do this.
    Thanks
    Cypray

    The following in google returns a number of links that look like it discusses this. I know as well that the user/pwd issue has been discussed on this site before.
    java http "file download"

  • Ssl with NES for files inside '.war' in WLS.

    hi
    Is this connection possible for pages served by WLS?
    browser ---(ssl)https--->NES->plug-in----plain-http--->WLS
    If yes, then my question is how to setup a secure session for my form-based login.jsp page that resides inside a '.war' file.
    I want to use ssl to transmit the login-id and password between the browser and NES only.
    2. In the above setup does the user-data-constraint element in web.xml have any effect on the data flow between the browser and NES?
    thanks
    sriram

    hi
    Is this connection possible for pages served by WLS?
    browser ---(ssl)https--->NES->plug-in----plain-http--->WLS
    If yes, then my question is how to setup a secure session for my form-based login.jsp page that resides inside a '.war' file.
    I want to use ssl to transmit the login-id and password between the browser and NES only.
    2. In the above setup does the user-data-constraint element in web.xml have any effect on the data flow between the browser and NES?
    thanks
    sriram

  • Need help to open and look for file by name

    Hi,
            Im needing help to open a folder and look for a file (.txt) on this directory by his name ... The user ll type the partial name of file , and i need look for this file on the folder , and delete it ....
    How can i look for the file by his name ?
    Thx =)

    Hi ,
        Sry ,, let me explain again ... I ll set the name of the files in the follow order ... Name_Serial_date_chanel.sxc ..
    The user ll type the serial that he wants delete ...
    I already figured out what i need guys .. thx for the help ^^
    I used List Directory on advanced IO , to list all .. the Name is the same for all ... then i used Name_ concateneted with Serial(typed)* .. this command serial* ll list all serials equal the typed , in my case , ll exist only one , cuz its a count this serial .Then i pass the path to the delete , and its done !
    Thx ^^

  • Need Help with script For Bulk Users Name & Description Updation

    Hi Guys,
    I have below requirement :
    We are having one windows 2008 stand alone server with 200+ local users (No Active Directory Account).
    1. Requirement is to update each account's "Full name" and "Description field" with same text. Which means , Full name and Description field will be same with same text. No other changes are required. )Attached the screenshot)
    Can you guys pls help me out with any scripting (vbs , powershell , DOS .etc etc) method to accomplish this task quickly as manual process is very troublesome and take long time.
    Any help will be highly appreciated,
    Thanks,
    Suvajit Basu

    Hi,
    I dont have any script but seeking for a help.
    Thanks,
    Suvajit Basu
    In that case you should read this first:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
    Prewritten scripts can be found in the repository (Brent has already suggested one for you):
    https://gallery.technet.microsoft.com/scriptcenter
    If you can't find what you need and you can't write your own, you can request a script here:
    https://gallery.technet.microsoft.com/scriptcenter/site/requests
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How can I hash with the MD5 for file

    I am a new learner in Java.
    Is there any useful code example or materials for me to learn how can i hash with MD5 for file.

    import java.security.*;
    import sun.security.provider.Sun;
    import java.io.*;
    import sun.misc.*;
    public class DigestOfFile
        public DigestOfFile(String mode) throws Exception
            assert(mode != null);
            digestAgent = MessageDigest.getInstance(mode, "SUN");
        synchronized public byte[] digestAsByteArray(File file) throws Exception
            assert(file != null);
            digestAgent.reset();
            InputStream is = new BufferedInputStream(new FileInputStream(file));
            for (int bytesRead = 0; (bytesRead = is.read(buffer)) >= 0;)
                digestAgent.update(buffer, 0, bytesRead);
            is.close();
            byte[] digest = digestAgent.digest();
            return digest;
        synchronized public String digestAsBase64(File file) throws Exception
            byte[] digest = digestAsByteArray(file);
            String digestAsBase64 = base64Encoder.encode(digest);
            return digestAsBase64;
        synchronized public String digestAsHex(File file) throws Exception
            byte[] digest = digestAsByteArray(file);
            String digestAsHex = encodeBytesAsHex(digest);
            return digestAsHex;
        private static String encodeBytesAsHex(byte[] bites)
            char[] hexChars = new char[bites.length*2];
            for (int charIndex = 0, startIndex = 0; charIndex < hexChars.length;)
                int bite = bites[startIndex++] & 0xff;
                hexChars[charIndex++] = HEX_CHARS[bite >> 4];
                hexChars[charIndex++] = HEX_CHARS[bite & 0xf];
            return new String(hexChars);
        private static final char[] HEX_CHARS =
        {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
        private MessageDigest digestAgent;
        private BASE64Encoder base64Encoder = new BASE64Encoder();
        private byte[] buffer = new byte[4096];
        public static void main(String[] args)
            try
                java.security.Security.addProvider(new Sun());
                DigestOfFile shaDigestAgent = new DigestOfFile("SHA");
                DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
                for (int argIndex = 0; argIndex < args.length; argIndex++)
                        String base64Digest = shaDigestAgent.digestAsBase64(new File(args[argIndex]));
                        System.out.println("Base64 SHA of " + args[argIndex] + " = [" + base64Digest + "]");
                        String hexDigest = shaDigestAgent.digestAsHex(new File(args[argIndex]));
                        System.out.println("Hex    SHA of " + args[argIndex] + " = [" + hexDigest + "]");
                        String base64Digest = md5DigestAgent.digestAsBase64(new File(args[argIndex]));
                        System.out.println("Base64 MD5 of " + args[argIndex] + " = [" + base64Digest + "]");
                        String hexDigest = md5DigestAgent.digestAsHex(new File(args[argIndex]));
                        System.out.println("Hex    MD5 of " + args[argIndex] + " = [" + hexDigest + "]");
            catch (Exception e)
                e.printStackTrace(System.out);
    }

  • Problem with Save data with report

    Post Author: ramprosoft
    CA Forum: General
    Hi,
    I am new to CR and using Crystal Reports XI with SQL Server 2000.
    I'm not able to remove the saved data in a report. I have played around different options, but unfortunately I'm not able to remove the data. I have checked variouse places in web above this issue not able to find a solution, so decided to open a new post. The problem is :
    I have created a simple report and saved with-out data (1st version) the file size was 16KB. After few changes I have saved the same report with Data, the file size become 1065 KB. Its perfect and I can view the report in Report Viewer. Great Stuff!. Now the Testing completed, I would like to move this report to production environment, I notice that I'm unable to remove the data. I have played around various tricks like below, but it didnt work well.
    Trick 1:
    Uncheck: File->Options->Reporting (tab)->Save Data With Report.
    Check: File -> Options -> Reporting (tab)->Discard Saved data on Open,
    Uncheck: file-> Report Options -> Save Data With Report.
    File -> Save Data with Report (Not selected)
    Opened the report and try "save" and also tried "save as", still the size is 1065.
    Trick 2:
    I enabled all "Save Data with report" feature. Deleted all the rows in the table related to the query, previewed the report and Saved the report with "Save Data with report" featuer. But now, the funny part happen, the file size increased to 1070kb, instead of reducing. Worst Stuff!!!
    Trick 3:
    Updated the latest version of Patch and tried above tricks, still i'm not able to remove the data.
    Appreciate, if you could help me to fix the problem.
    thanks in advance

    Post Author: salmanq
    CA Forum: General
    Hi, This
    post is very informative, however I would like some specific information. If
    someone can help me then please send me a private message. Best Regards,
    Wholesale Pages UK Dropshippers
    | Wholesale Suppliers
    Australia Wholesalers and
    Dropshippers | Dubai Property and Real Estate

  • Tags v/s prior way to highlight file / doc names in Finder

    Is there an app or some other way to restore coloring the full line for file/doc names in Finder?  Color Tags are too tiny!

    I just found this app that does it: XtraFinder adds Tabs and features to Mac Finder.
    The initial install did not work. There is a fix though:
    open the installer dmg
    in the Extra folder, click on RemovePackageSignature
    continue with the installation.
    In general I am always wary of apps like this that add features to the GUI, as they are common sources of subsequent problems, and the apps themselves rarely (if ever) add anything really useful. But in this case the automatic column width is very nice and does seem to work.

  • Need action to save a copy with original file name with suffix

    Hi All,
    I am using photoshop 7 (yeah its old, but working fine for me for general purposes). The problem is I have got this new task where I have to provide 3 copies of the same image but with different portions of it. I have several images (.jpeg) which I need to crop two parts of the image and save as two new image files. The requirement is that I need the copy images to bear the same name as the original and with a suffix to identify which cropped portion of the image is it. example, original file name is AB1001.jpg (1600x1200), 1st cropped image name to be AB1001_P.jpg (200x250) and the 2nd cropped image name to be AB1001_Q.jpg(100x180). I have around a 180 files, so need to do it in a batch, pls suggest how can it be done.
    Any help in this regard is much appreciated.
    Regards
    Chhuppa Rustam

    While a script would probably be best, photoshop 7 requires
    you download a scripting plugin which may or may not install
    in photoshop 7 depending on your version.
    You can probably do what you want with actions. The file naming part
    is not hard, but i have a couple of questions about the cropping.
    Are all the images the same size and are the crops in the same position for each?
    In other words on the P crop (200x250), is the crop in the same position on each
    image or different for each?
    MTSTUNER

  • We use a doc template to create a purchased part spec document and then save them as pdf formatted files.  These part spec documents are also appended with the datasheets for these purchased parts.  When we want to update/revise the document, is there a m

    We use a doc template to create a purchased part spec document and then save them as pdf formatted files.  These part spec documents are also appended with the datasheets for these purchased parts.  When we want to update/revise the document, is there a method, using Acrobat, to make those updates to the pdf, or must we go back to the doc template and basically generate a new document?
    Also, our resulting pdf documents aren't searchable.  How can we generate pdf documents that are searchable?  I may want to search for a part value or name within the body of these pdf documents, but currently can't do that...very inconvenient.
    Can you assist?

    Not totally sure about the search issue. A lot depends on how you created the PDF and what is in the datasheets you attached (like are they graphics?). The doc portion should be searchable as long as you used print to the Adobe PDF printer or PDF Maker. For your use, it may be that the print is adequate. However, the result should be searchable (unless maybe you had a form with filled in fields and created the PDF with PDF Maker. I think the form data may be retained in form fields and the fields are not searchable. In that case, a print might be a better procedure. (it would help to know the versions of WORD and Acrobat as well as the exact process you used to create the PDF.)
    If the appended data sheets do not change, then you might try opening the original PDF and then using Replace Pages to replace the file created from the DOC file.

  • I am having trouble with an excel file wanting to save when no changes were made & opening as read only for the 2nd person - but allowing them to save the file.

    1) I am having trouble with an excel file wanting to save when no changes were made.  As soon as you open the file and exit.  It prompts for a save.
    All excel versions are 15.0.4701.1002.
    Using a table.
    the functions CELL, OFFSET, TODAY, INDIRECT, NOW, INFO and RAND are not being used.
    2) Same file.   2nd person is being told they are opening the file as read only - but when they are quitting excel prompts them to save the file. 
    Everything was working fine.  I started having problems with Excel, IT wiped my version out and re-installed office. 
    File is on networked server HP - Windows Server 2012 Essentials.  
    We are all on Windows 8.1 Pro.
    I really hope someone can help - the excel expert had no answer - and passed me along to here.

    I copied the whole file and started deleting worksheets one at a time and testing it by closing it and re-opening it then closing it again – to see if it wanted to save. 
    Once all the pivot tables were deleted – the problem went away. 
    I found that some of the pivot tables had automatic refresh upon open, so this caused the excel to think data had changed. 
    It is fixed now.  By clicking on one cell of the pivot table, analyze, options, data and uncheck the 3<sup>rd</sup> square down to not automatically refresh.  NOT A NETWORK ISSUE.

Maybe you are looking for

  • G510 install Win 8.1 on a smaller SSD. What files to copy.

    Yesterday I got a new G510. The HD is not in good condition after dropping it. I wanted to swap the 1TB HD 5200 rpm  anyways for my 120 GB SSD. I can still get at the files on the original HD. What files and/or partitions do I need to copy to the SSD

  • Error in smartform calling in a report

    Moved from General to Form Printing.  Please take care to post in the correct forum. Hi All, I'm working on standard Smartform 'EBPP_DEBIT_CREDIT_MEMO'(biller Notification) calling in a report.In report smartform generating function module successful

  • Purchase Order FAX status

    I need to print status of Purchase order FAX (successful or not) stored in SOST. Where is the link from PO to SOST??

  • Rejected book order

    I am a complete beginner to all this but can anyone help me! I experienced huge problems uploading..it got stuck at 0% for hours so I finally rebooted, once I had managed to get out of Aperture, and then it all worked fine. However, I have now receiv

  • Belkin iPod FM transmitter problem with iPhone

    I've been using a Belkin FM transmitter with my iPod for listening to music in my car. It connects to the dock interface, and charges up the iPod as well as transmitting the music. However, when I connect it to my iPhone and play music, the music onl