Save a copy of the document to the office

Hello

I am trying to use the Save function under to just save the file in the my desktop. but I don't want to convert anything.

the Save function under ask a saveOptions where we configure the options of saveas.

I want just the open file to be copied to my desktop.

Follow my actual code:

saveFile = new file ("~ / Desktop /" + app.activeDocument.name)

saveOptions = new JPEGSaveOptions();

saveOptions.embedColorProfile = true;

saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

saveOptions.matte = MatteType.NONE;

saveOptions.quality = 5;

app.activeDocument.saveAs (saveFile, saveOptions, true, Extension.LOWERCASE);

But this code modifies the actual file.

If I open a tiff file and use this script, it will save a jpeg... I do not not to change the open file. Just copy it to my desktop

Best regards

You must either determine the existing format of the document and use the correct saveOptions for this format or make reference to the file and use the File.copy () method to move.

function getFormat(){
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    try{
        if(executeActionGet(ref).hasKey(stringIDToTypeID("format"))){
            return  executeActionGet(ref).getString(stringIDToTypeID("format"));
        }
    }catch(e){}
};
var saveFile = new File( "~/Desktop/" + app.activeDocument.name);
var docFormat = getFormat();
switch(docFormat){
    case 'Photoshop':
            // set photoshop saveOptions
            break;
    case 'TIFF':
            // set tif saveOptions
            break;
    case 'JPEG':
            // set jpg saveOptions
            break;
    // add case statements for other formats you want to support
    default:
         // handle un-supported formats and newly created document
}
app.activeDocument.saveAs(saveFile, saveOptions, true,Extension.LOWERCASE);
function getDocPath(){
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var desc = executeActionGet(ref);
    var res = desc.hasKey(stringIDToTypeID('fileReference')) ?  File(desc.getPath(stringIDToTypeID('fileReference'))).exists: false;
    return res ? File(desc.getPath(stringIDToTypeID('fileReference'))):false;
};

// may want to do a normal Document.save() to make sure file is current
var saveFile = new File( "~/Desktop/" + app.activeDocument.name);
var existingDocFile = getDocPath();
if( existingDocFile ){
    // use copy first
    existingDocFile.copy(saveFile);
    // uncomment if you want to 'move' the file
    //existingDocFile.remove();
}

Tags: Photoshop

Similar Questions

  • How to save a copy of the file? (simple javascript needed)

    I'm a noob, so need a Javascript/installation for InDesign CC script, which runs automatically when a file is openand saves a copy of the document to a specific folder, to the present time (i.e. "c:/file/filename_COPY_6_MAY_2014_23_59_59").

    This code is just for this work? :

    var dmd = app.activeDocument;
    var oldDocName = dmd.name;
    //make new file
    var newDocName = oldDocName.substring(0,oldDocName.length-5); //removes ".indd"
    var dd = new Date;
    var NewFile = new File("/c/backups_folder/" + newDocName + dd.getDate() + "_" + dd.getMonth() +  "_" + dd.getHours() + "-" + dd.getMinutes() + "-" + dd.getSeconds() +".indd");
    //copy
    oldDocName.copy(NewFile);
    
    
    
    
    
    
    
    
    
    

    Hi all

    I don't think that the link you have provided on stackflow meets your problem and certainly not the best way.

    Hopkins response for sure does not seem be correct (sorry)

    I think that my script below is the best method.  Don't lead to annoying delays in file open.

    Put it in your startup script file

    Trevor

    // https://forums.adobe.com/message/6363852#6363852
    // By Trevor
    #targetengine document_copy
    (function () {
        if (app.eventListeners.itemByName ("saveCopy").isValid) app.eventListeners.itemByName ("saveCopy").remove(); // makes debugging easier and prevents multiple eventListener creations
        var mySaveCopyEventListener = app.eventListeners.add("afterOpen", saveCopy);
        mySaveCopyEventListener.name = "saveCopy";
    }) ();
    
    function saveCopy(ev)  {
        if (ev.target.constructor.name !== 'Document') return;
        saveCopy.Folder = "C:/backups_folder/"; // Change as needed
        if (!Folder (saveCopy.Folder).exists) {
            Folder (saveCopy.Folder).create();
            $.sleep(300);
        }
        if (!ev.fullName.copy (new File (
            saveCopy.Folder + // folder name
            ev.fullName.name.replace(/.[^.]*$/,"") + // file name without suffix
            (" " + new Date).replace (/:/g,"\xB7").replace(/\s\S+$/,"") + // date Change format as desired
            (ev.fullName.name.match(/\..+$/) ? ev.fullName.name.match(/\..+$/).toString() : ".indd") // suffix could be idml or who know what
            ))) alert ("Something messed up, a copy was not made");
    }  
    
  • EVERYTIME I OPEN A FF OF OUTLOOK E-MAIL WANTS TO SAVE A COPY OF THE FILE IN A TEMPORARY FOLDER, HDI MAKE STOP

    in outlook, click to open a new email. FF opens and a tab appears with a string in a folder:
    file:///C:/users/tymn/APPDATA/local/Temp/%7B3586F5EB-854A-4DA8-B2F7-8C764B716CEA%7d.html

    It seems to be trying to save a copy of the email from outlook to a drive. I do not have this, it's boring. even when I click on the box to not show it, it always does...

    I had the same problem with outlook 2010 and firefox 8.x in WinXP.
    The problem seems to lie between Firefox and outlook.
    Problem only appears when Firefox is the default browser. My vision is not no matter what plugin/add/market.

    Workaround solutions:
    1 use IE as default browser.
    2 backup Firefox BookMark. Then the latest version of Firefox uninstall, delete all settings in the Firefox UN-installing. Turn it back on. Finally, reinstall Firefox and restore the bookmark, and then make as default browser.

    Problem always appear after you apply this workaround solution.

  • Save a copy of the emails opened on the Server POP3 format

    I have POP3 format on windows email. I want to save a copy of the emails opened on the server, so I can access it later from a distance (with my phone). How can I do this?   Thanks in advance.

    I have POP3 format on windows email. I want to save a copy of the emails opened on the server, so I can access it later from a distance (with my phone). How can I do this?   Thanks in advance.

    Open Windows mail > tools > accounts > click your account > properties > Advanced tab > under delivery, check ' leave a copy of messages on the server ' > OK for the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • Outlook Express saves a copy on the internet of a modified attachment (Doc Excel) of an e-mail copied to the file "sent"?

    When it is in the Excel Doc attachment, clicking on 'Close' (the ' X' in the upper right) saves the document in the office but not the changes?

    Hello

    What exactly are you trying to do?

    If you try to save the attachment after editing, I suggest to click on record under and try to save the document.

    If the problem is not resolved, please provide more information to help you best.

  • Open, save a copy of the psd as a layered tiff file

    Looking for script or action that would allow me to open selected (perhaps a folder) psd files, save them under layers of hair in the same folder. or a new folder also.

    Suggestions, ideas.

    Vince

    The best thing to do is to create this action yourself. You will learn a lot from that.

    Open one of the PSD.

    Create a new action and start recording.

    Choose file--> save as and select the Tiff format and make sure layers has a tick mark next to him.

    Any location you save will be held where all files go when you run the action (by default anyway).

    Do not change the file name, in this way, the names of original PSD files will be used when you batch process.

    Now, close the file without saving changes if you want to use this action on a folder. You don't want to accidentally spoil the original files after all.

    After doing these things you can stop the recording.

    Now, the action was created.

    To run it go to file--> controller--> lot.

    Select your newly created Action.

    For Source, select 'folder '. Then choose the folder with all the PSD in Photoshop you want to save as TIFF files in layers.

    If you want to save in a different location just change this in the 'Destination' menu by selecting "file".

    All you have to do is now click OK and look at your batch of additional transformations.

    Here is the action example that I just created to save the PSD in Photoshop layered tiff files:

    https://DL.dropboxusercontent.com/u/24262740/save%20To%20layered%20tiffs.ATN

    In this example layered tiff files go to 'C:\test\ '. I created it to make sure that what I said actually works.

    Edit: screen on the lot, you can also select the Source "Opened files", since that is what you wanted to do. If you do that with the example action above the open files is closed after the batch process took place. It's because when I created the action I closed the file before to stop the action. When you create these actions yourself, you get to decide these small details but important.

  • Save a copy in the specific folder and edit original

    Is it possible to bridge to make a script that:

    1. Copy a picture of the original to a particular folder another folder
    2. Give the original photo, a keyword, a label or a field of metadata with today's date?

    I've been using PHP and VBA and have just started to learn JavaScript, so I might be able to understand something of my own if you point me in the right direction. If you could give me the script ready to use, I will be very grateful.

    Our location:

    We publish photos in a weekly news journal and online. We have pictures in one folder, ready for use. When put us a picture in production copy us to another folder, but we would like to know if and when a picture has been used, so we are not using the same photo over and over again. It would be great if we can mark the original somehow "used" and "date".

    Thank you!

    Bridge CC 6.3.1.186 using x 64

    Here is an example of adding 'Used' and the date in the title field also copy the file to a selected folder.

    #target bridge
       if( BridgeTalk.appName == "bridge" ) {
    copyAndDate = MenuElement.create("command", "Copy and Date files", "at the end of Tools");
    }
    copyAndDate.onSelect = function () {
    if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
    var copyFolder = Folder.selectDialog("Please select folder to copy files to...",Folder(app.document.presentationPath));
    var sels = app.document.selections;
    for(var a in sels){
    var thumb = sels[a];
    thumb.copyTo(copyFolder);
    var md = thumb.synchronousMetadata;
    md.namespace =  "http://purl.org/dc/elements/1.1/";
    md.title = '';
    md.title = "Used " +  new XMPDateTime(new Date());
        }
    };
    
  • can I save a copy of the library of Photos on a hard drive that is formatted for PC?

    I've seen several references to the requirement that a hard drive be formatted to Mac OS... but here's my situation... I back up my everyday Mac files and folders (with commands simple copy/paste) on a 2 TB disk that has been formatted for a pc. It seems to work fine for me.

    MY QUESTION - can I copy the photo library (mine is now 15G) of this same drive (even once... it is NOT formatted in OS) to provide care? Yes, I'm not going to try to "open" here but I can copy it on the Mac and do work properly. im just trying to be able to recover from a crash of my Mac.  If my Mac crashed, I won't be able to backup the library of Photos of this PC drive formatted to my new Mac, and then open it as usual.

    extra credit question: what exactly is a "library" file I see that it shows with another icon in the finder, compared to a folder or a file.  im guessing that it is some kind of package that has the hierarchy within this user every day didn't need to dive in...? but in the context of my Q... can I copy this library (from 1 location 2 location) as if it was a garden variety file?

    1. no outside a Mac OS Extended format disk image. Note that if the drive is formatted FAT32, the file size of the image must be less than 4 GB.

    2. Yes, it is.

    (138375)

  • Try to save a copy of the contacts and emails in windows live to get the error cannot create .csv file

    Try saving a copy of contacts and emails in windows live to get the error can not create .csv file any help appreciated.

    First create new folders to the location where you want it on a local hard drive. Then use the Browse button in the Export Wizard to navigate to the files you created. Once the export is complete, copy the files to their final destination.

    Windows Live products and services are not covered by these forums. You will find support, solutions and forums for them to the Windows Live Solution Center. When you ask a question here, you should give your version of the software, because the answers vary depending on the version. In WLMail to find, has press on ALT - H. If it doesn't show you the version and the build number, press on escape to two times, and then Alt - F B.

    Noel

  • My download from Creative cloud never appeared. I disabled my firewall and the pop up and I'm connected to the internet to 100%. Still no download never appears, and I can't save or copy all the links that work. Now what?

    I have tried everything and still not get my download to appear. I don't know what else to try.

    Hello

    Please see solve common Creative Cloud activation and deactivation questions. and Solutions to connect, activation and errors in connection with Cloud applications and Creative Suite creative

    Hope that helps!

    Kind regards

    Sheena

  • Way to save Sticky Notes at the office closed AFTER SN?

    I just started to use app reminder of Win7. I noticed that, after closing the program in my taskbar, the note itself disappeared until I restarted the program SchoolNet. Of course, I'm in the habit of closing a program after that I'm done with its use; is there a way to get the Sticky Notes that I write, to stay on the desktop AFTER I stop the program itself?

    You are right. They are not saved, nor can they be saved to the desktop.

    Why close Sticky Notes If you want available on the desktop?

  • How to stop windows 7 from automatically saving a copy of the file to the library?

    I have a desktop hp brand new high.  I installed Microsoft Office 2010.  Whenever I save a file, photo, etc, it saves a copy of the "library".  How it stop doing that?  I read about using the library and he said I could save a copy in the library, but it does it automatically.  Is there a way to stop this?  A I inadvertently set up in this way?  If I delete a file from my documents, it is removed from the library and vice versa.  From what I've read, it should be and the options, not automatic.  If you can help, please dumb it down a lot because I'm not well versed in computer talk.  Thank you very much!

    The library is in fact that index files and in showing them, not actually recording a copy I think. With Explorer open where you can see libraries, choose a category from the left such as the images pane and then right-click and choose Properties. In the window that opens, you should see your C:\ User\Pictures folder that is listed in the index. Click Select, and then click Remove. Now library should not index files. Select each category for example Documents, etc and do the same thing.

  • Save PDF searchable to the c# IAC program

    I found the program BasicIacCS in the Acrobat SDK. He opens a PDF file and gets the number of pages.  I modified the program to save a copy of the PDF file.  The copy is not searchable, but I need it to be.   Should what code I?  Manually, I have to click on tools and text recognition, but I can't find anything like this in the documentation of the IAC.

    Access to the function of OCR (text recognition) is not possible via the API of the IAC.  You need to write a plugin for Acrobat using C/C++

  • Disable "save a copy"?

    Disable CanI 'save a copy' in a distributed pdf form?

    I don't want users to accidentally delete extended features in Adobe Reader, that is, when the user selects "Save A Copy" (after the opening in their email) they get invited with a warning that they will remove extended functionality (saving of rights), they never read it, complete the form, then can't save it!

    I want to disable it in Reader and Acrobat Pro and set a password in order to proceed to the registration of the rights.

    I add instructions in bright red flashing letters of warning e-mail users NOT to SAVE a COPY, but it adds a step more boring to my process and a potential point of failre for the data collection process...

    'Save a copy' is only available in Acrobat format. Adobe Reader users can save extended PDF files after that comments or form fields have been applied, but cannot disable rights making.

    It is not possible to disable the option menu to save a copy in Adobe Acrobat format by using scripts or security settings in the PDF file.

  • Automatic copy of the documents stored in iCloud Mac HD?

    Is it possible to save automatically documents etc. that I record on iCloud? Although I love synchronization between devices, I don't have a faith in Apple to have my only copy of an important document living remotely and independent of my will on the iCloud.  I'd be happier with a local copy as I guarantee you access to.  Y at - it a soft which should save a copy on hard drive on my Mac when I save on iCloud?

    If you use iCloud Drive on your Mac, you already have a copy of each document. They are simply hidden from your part.

Maybe you are looking for

  • How can I get my photos and data after an interrupted in my Iphone 6 software download

    Hi, everything started when I agreed to my iphone's software update, so I made a backup on my computer before that, but does not copy my photos on my external hard drive (my bad), so by updating I stop my phone thinking I could stop it and do it late

  • Where are iOS Safari preferences

    I can't find the preferences of Safari in the IOS of Safari version.  My wife's IPad opens to a page that she hates and would like to change to open at Yahoo or Google.  I'm not IOS so I'm no help.

  • Realtek sound effects on y580 tab

    I was wondering why there is no sound effects for SD realtek audio Manager tab. I know it's part of the software. I had one with my old toshiba laptop. Lenovo did disable this because the key/dolby theater?

  • VGA, Dell inspiron 530 s, Panasonic tv

    Hey guys new to the forum. Sorry I don't use a lot of grammar online. Well I recently got my old Dell back from my grandparents. It's a dell inspiron 520 s. Well I don't have a computer here monitor so I thoguht I would use my TV. Well, I pluged the

  • HP Photosmart all-in-One Printer series - B010 with Mountain Lion (10.8.1) / Wireless printing

    I tried to find manuals how to connect my HP Photosmart all-in-One Printer series - B010 to the network in order to get wireless printing, I followed a few articles, but it seems that my problam is that I can't find a way to connect the printer to th