Save as - name of the active document

Does anyone know how script backs up new name of file with Javascript for Photoshop?

I can save the file under a new name, but it does not replace the current active document that it records since. The current active document still has the old name.

saveFile = new File (filePath () + "/" + fileName ())

saveOptions = new PhotoshopSaveOptions();

saveOptions.layers = true; Preserve layers.

saveOptions.embedColorProfile = true; Keep the color profile.

saveOptions.annotations = true; Keep annonations.

saveOptions.alphaChannels = true; Preserve alpha channels.

saveOptions.spotColors = true; Preserve spot colors.

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

$.writeln (savefile);

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

If you set it to 'true' to 'asCopy' (the third property) the behavior seems to be as expected.

Tags: Photoshop

Similar Questions

  • File name of the active document

    Hello friends,

    Now that I managed to find quotes (special strings) in paragraphs, notes, tables and table notes - all with your generous help - I need to know the name of the file (path) of the current document (or book).

    All I've found is how to get the name of an element of the book file (finally that I need too, but later).

    How can I find the file name of the active document (which is not part of a book) and

    How can I find the file name of the current book?

    Thanks again for your help

    Klaus

    Friends,

    Suddenly, I found the answer (research in the reference of the oject for 'Filename' rather than 'file name' - 'path' in the FDK reference):

    alert ("Now processing book\n"+ app.ActiveBook.Name);
    alert ("Now processing document\n"+ app.ActiveDoc.Name);
    
  • get the name of the active tool and set the "BRUSHSIZE' of the Freeformpen tool

    Hello all,.

    Can I use the same script to swap "pentool' 'freeformPenTool' and 'vice versa' with a ' if... Else statement.

    How can I get the name of the active tool?

    then set the size of the tool Freeformpen: "PaintingCursors BRUSHSIZE?  (ScriptingListener does not save this setting).

    But I have no example on "PaintingCursors"...

    then set the size of the Freeformpen too

    What is that supposed to mean? A path has no width or brushsize self.

    How can I get the name of the active tool?

    2016, use it at your own risk.

    #target photoshop

    Var ref = new ActionReference();

    ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("tool"));

    ref.putEnumerated (charIDToTypeID ("capp"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

    var applicationDesc = executeActionGet (ref);

    Alert (typeIDToStringID (applicationDesc.getEnumerationType (stringIDToTypeID ("Tool")));

  • Get the path of the active document from Photoshop

    It works in Photoshop and Bridge script (Javascript)

    var myPath = activeDocument.name;

    Tester.PSD

    This only works in Photoshop script (JavaScript), but not in the bridge.

    var ProcessFolder = activeDocument.path

    actually stops the script, without error or warning.

    How can I get the path to the file in the active document in Photoshop through Bridge?

    Thank you!

    Hello

    You can use BridgeTalk to communicate between applications

    In this case, there is the code and you must run it from the bridge to get the information you need for photoshop:

    // run this from Bridge to get the path of the active document
    // if photoshop is not running, it gives that message
    // if photoshop is Busy, it gives that warning
    // if photoshop has any images opened, it avoids getting the path and warn you
    
    pathFromPS();
    
    function pathFromPS() {
        var bt = new BridgeTalk;
        bt.target = "photoshop";
        bt.body = '(app.documents.length > 0) ? app.activeDocument.path : "No active images";';
        bt.onResult = function (resObj) {
            activePath = resObj.body;
        }
        if (BridgeTalk.getStatus (bt.target) == 'IDLE') {
            bt.send(3);
        } else {
            activePath = (BridgeTalk.isRunning(bt.target)) ? "[Busy]" : "[Not Running]";
        }
        return activePath;
    }
    
  • How to add a character style in the active document

    Hi experts

    How to create a character style in the active document.

    How to make the script work.

    Thank you

    Respect of

    John

    var myCharacterStyle;

    myDocument var = app.activeDocument;

    var myCharacterStyle = myDocument.characterStyles.add({name:"c"});)

    myCharacterStyle.strikeThru = true;

    myCharacterStyle.strokeColor = 'Black ';

    myCharacterStyle.add)

    There is not much to say about your code. Only the last line would cause a problem. A possible hiccup is also on the fact that the style may already exist when you want to add.

    myDocument var = app.activeDocument;

    var myCharacterStyle = myDocument.characterStyles.item ('c');

    ! myCharacterStyle.isValid & myCharacterStyle = myDocument.characterStyles.add({name:"c"});)

    myCharacterStyle.strikeThru = true;

    myCharacterStyle.strokeColor = 'Black ';

  • Digitally sign all Signature fields in the Active Document

    I have a script that will sign a unique digital signature with the name of the field field.

    I need to see the script so that it will sign in fields many/any signature in the active document without having to put the name of the field in the script, as domain names vary with each document.

    Can someone advise please how do I change the script to sign all the fields in the active document, regardless of the domain name?

    function myOtherTrustedFunction()
    {
    app.beginPriv ();
    Get and connection to the Security Manager

    var oSigHdlr = security.getHandler ("Adobe.PPKLite");
    oSigHdlr.login ("123", "/ c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx");

    Signature properties configuration

    chk var = this.getField ("Checked");
    If (chk! = null) {}

    Apply the Signature and store it in the original file

    bRtn var = chk.signatureSign ({oSig:oSigHdlr, bUI:false, oInfo: {password: "123"}});
    }

    app.endPriv ();
    }

    Any help will be most appreciated.

    How about this:

    var myEngine = security.getHandler("Adobe.PPKLite");
    myEngine.login("123", "/c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx");
    
    for (var i = 0; i < numFields; i++) {
    
        // Get the current field object
        var f = getField(getNthFieldName(i));
    
        // If it's a signature field and not already signed, sign it
        if (f.type === "signature" && !f.value) {
    
            // Sign the field
            f.signatureSign(myEngine, {password: "123"});
    
        }
    }
    
  • How to print ONLY the active document?

    Whenever I go to file/print program PSE 9 darn all working files sends in the tray of the printer. I searched online for 2 hours, now looking for an answer.

    I enjoy working with several to several files in the 'bin' and prefer to print only the active file, I am currently working on without having to close the "working files" before I can print. How can I print ONLY the active document or file in the location of project? Please help, I upgraded from PSE 3 PES 9 and really like the updated features, but what a pain in the neck by default becomes the best of me.

    Select it in the trash before calling to the top of the print window. If nothing is selected, everything happens in the print window.

  • "Cannot save (file name) because the file is already in use or left open."

    Hello
    When I tried to save as a file, I get an error msg:
    "Cannot save (file name) because the file is already in use or left open."

    The file is unwilling to accept any Photoshop.

    Mac Pro, OSX 10.5.6
    Photoshop CS4.

    I searched the Forum but did not find anything even though I'm sure someone has already asked it.

    would love to get a solution for this.
    Thank you
    Shlomit

    If Photoshop says that the file is opened - then some external process left the file open. It has nothing to do with it being open in Photoshop, or even in the bridge. This sometimes happens when Spotlight had bugs (who came more than once and been corrected in versions of dot operating system).

    The external process could be another application or service to OS like Spotlight.

  • Safeguarding of documents through scripting: name of the active file Get and set save path/file type

    I am writing a script that will:

    -Do all the invisible layers

    -Make the layer visible ' background'

    -Remove all the invisible layers

    -Save the document as EPS file (leaving the original intact)

    I am new to scripting and I based my script by copying the code of other scripts.

    Here is my code:

    var doc = app.activeDocument;

    var name = doc.name;

    hide var = function () {/ / hide all layers (based on http://forums.adobe.com/thread/644267( )}

    var L = doc.layers.length;

    for (j = 0; j < L; j ++) {doc.layers [j] .visible = false ;}

    }

    masquer();

    loop through all layers

    for (var i = 0; i < doc.layers.length; i ++) {}

    Create the illusrtratorSaveOptions object to set options to HAVE

    var saveOpts = new IllustratorSaveOptions();

    Definition of the IllustratorSaveOptions properties.

    saveOpts.embedLinkedFiles = true;

    saveOpts.fontSubsetThreshold = 0.0

    saveOpts.pdfCompatible = true

    Implemented Variable for the name of the access layer

    var currentLayer = app.activeDocument.layers [i];

    Loop through the layers and make the background layer visible

    If (currentLayer.name == 'Background') {}

    docName = name + currentLayer.name + ".eps";

    currentLayer.visible = true;

    }

    }

    / / Remove the invisible layers (based on http://www.cartotalk.com/index.php?showtopic=7491( )

    var myDoc = app.activeDocument;

    var layerCount = myDoc.layers.length;

    for (var ii = layerCount - 1; ii > = 0; ii-) {}

    var currentLayer = myDoc.layers [ii];

    currentLayer.locked = false;

    var subCount = currentLayer.layers.length;

    for (var subCount - 1; ss = ss > = 0; ss-) {}

    Underlayment var = currentLayer.layers [ss];

    subLayer.locked = false;

    If (subLayer.visible == false) {}

    subLayer.visible = true;

    subLayer.remove ();

    }

    }

    If (currentLayer.visible == false) {}

    currentLayer.visible = true;

    currentLayer.remove ();

    }

    }

    Save the document with a new name

    var saveName = new queue (doc.path + "/" + Nomdoc);

    doc.saveAs (saveName, saveOpts);

    Everything works well except:

    (1) it saves the document under the name of AdobeIllustratorBackground rather than the name of the document

    In addition, I don't know how to tell the script to save in EPS and specify the save location.

    Could someone give me some advice?          Thank you!

    There is an example script in Adobe Illustrator Scripting/CSx/Sample Scripts/JavaScript/miscellaneous/Save as PDF that has all the parts except the EPS Options.

    Go here for the script Guides and references.

    http://www.Adobe.com/devnet/Illustrator/scripting.html

  • Screen saver computer name on the logon screen

    Is it possible to get the name of the computer screen saver to display the clock on the login screen?

    Not without using a saver different screen - and you are looking to do with the server itself, or with clients configured and managed by the server?

  • How do I get the content from another file and paste it into the active document instead of certain string?

    I am newbie in indesign scripting of animals. So I apologize because I couldn't post my essays.

    Objective:
    I have a .indd document which will be a figure of legend, label etc. I need to copy the content (a figure that is editable) else file indd of this document where the tag figure exists.

    For example:
    Sample.indd

    Some text Fig.1.1 caption some text 

    I need to copy the contents of figure1.indd and paste in the document sample.indd where Fig.1.1 string exist and so forth. Now I do it manually. But am supposed to automate this process.

    So, I need some hint how to do it using extendscript?

    I found something like below, to do so, but I have no idea to develop it further and also do not know if this approach is correct my results. Please help me

    myDocument=app.open(File("file.indd"),false); //opening a file to get the content without showing.

    myDocument.pages.item(0).textFrames.item(0).contents="some text"; //here I could set the content but I don't knw how to get the content

    // ?????? Then I have to paste the content into active document.

    Try this test nicely to your and end, hope this will help you.

    var myDoc = File("/D/Sample.indd");//Figure File
    var myFigDoc = File("/D/Figure.indd");//Destination File
    app.open(File(myFigDoc));
    app.activeDocument.pageItems.everyItem().select();
    myObj = app.selection;
    var myGroup = app.activeWindow.activePage.groups.add(myObj);//Grouping the objects
    myGroup.select();
    app.copy();
    app.open(File(myDoc));
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "Fig 1.1";//Figure caption text
    app.findGrepPreferences.appliedParagraphStyle = "FigureCaption";//Figure Caption Style
    myFinds = app.activeDocument.findGrep();
    for(var i=0;i		   
  • How to change the page numbers after adding &amp; save page numbers in the pdf document - need to change the existing page printed on the upper right in the header numbers

    How to change the page numbers after you add and save the page numbers in the pdf document - need to change the existing page printed on the upper right in the header numbers.

    These page numbers were initially created using Acrobat PDF header and footer.

    I have a 750 page pdf document that I've created.

    I have to sometimes the pages up and down after that I added the page numbers in the document by using the Header_Footer tool on the right column of tools.

    But after you save the document, if I get a few pages around, I can't go back and change the page numbers.

    I thought that the page numbers, as indicated in the header and footer must have changed automatically, but I guess that once its print, that it cannot be edited - is that, as what is?

    So I guess we should always first get a copy without numbers of pages before confirming the documents and the creation of an index.

    A way to remove these page numbers already there and add new page numbers.

    Its a lot of work to align 750 court documents and then realize that you must move some and then realize the page numbers cannot be changed and thus begin to do this all over again to compile which can take about 10 hours.

    My question is quite simple, but I hope that overall, I got my point. Sorry if I made it is too complex.

    If no simple way, want to know if anyone has another different tool or a few recommendations to better highlight what I'm doing wrong.

    Thank you for your review and response.

    You should be able to update with tools - Pages - header & foot-

    Update... It not work for you?

    If this isn't the case, then try to remove from this menu and then re - adding them.

    Tuesday, June 23, 2015 23:55, Fortune Mile [email protected]>

  • Issue of Photoshop CS5 - trying to save a name with the extension .jpg or .png

    Hello

    If I open a new file and go to save the extension names see (.jpg or .png). However, if I open an illustrator file in Photoshop and try to save it with the extension names aren't there (it's just save in the proper format, but I want the files to have the .jpg or .png in name without typing me in me.)

    Anyone know why this is, or how I can solve this problem?

    Later versions of Photoshop implemented what Adobe call JDI patches, which stands for Just Do It.  One of these fixes the recording directly in JPG format, files with layers, or 16-bit, or with workpaths, layers alpha or any feature that would otherwise be saved in PSD or TIFF.  With CS5, you'll need to flatten all layers and make sure that it is a color of RGB 8-bit file.

    Reading your question, you may be wondering how do default PS to JPG format during recording?  If so, use Save as and in the drop-down list format, Ctrl click JPG.  He uses this format providing that should be the case (not layers etc.)

  • Error: Could not save 'file name' because the file name was invalid. (PS CS6 + WIN 7)

    I recently bought a new desktop in WIN 7, but also Adobe Creative Suite CS6.

    My first internal hard drive 2 TB is the second installed is from my old PC, 250 GB.

    I get this error when you try to save a file to a file using the Save"" command.

    The message is false, because the file name IS valid.

    This error is persistent.

    This error will not occur when you perform the same operation on my second internal hard drive.

    This error occurs on the files above about 1 MB in weight.

    What is happening is that the original file which I try to do the "Save" command gets corrupted and lost.

    If I do not use the command "Save as" to save my work under a different name, my work is lost.

    The same problem occurs with the CS6 PS 64-bit and 32-bit versions.

    I am very disappointed and annoyed with what is happening.

    Any idea what's going on here?

    Then Yes, sugarsync may have much to do with the error.

  • Place the image in the active document 'not as smart object"

    How can I place an image in the current document, but not as a smart object?

    var filePath = new File(decodeURI('~/Downloads/Safari_logo.png')),
        currentValue = getPlaceRasterSmartObjectValue();
    
    if (currentValue == true) {
        placeRasterSmartObject(false);
    }
    
    placeEmbedded(filePath); /* Place Image */
    
    placeRasterSmartObject(currentValue); /* Return the default value */
    
    function placeRasterSmartObject(__bool) {
        var desc1 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putProperty(charIDToTypeID('Prpr'), charIDToTypeID('GnrP'));
        ref1.putEnumerated(charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
        desc1.putReference(charIDToTypeID('null'), ref1);
        var desc2 = new ActionDescriptor();
        desc2.putBoolean(stringIDToTypeID("placeRasterSmartObject"), __bool);
        desc1.putObject(charIDToTypeID('T   '), charIDToTypeID('GnrP'), desc2);
        executeAction(charIDToTypeID('setd'), desc1, DialogModes.NO);
    }
    
    function placeEmbedded(filePath) {
        var actDesc = new ActionDescriptor();
        actDesc.putPath(charIDToTypeID('null'), filePath);
        actDesc.putEnumerated(charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa'));
        executeAction(charIDToTypeID('Plc '), actDesc, DialogModes.NO);
    }
    
    /* Update: Check current value */
    function getPlaceRasterSmartObjectValue() {
        var ref = new ActionReference();
        ref.putProperty(charIDToTypeID("Prpr"), charIDToTypeID("GnrP"));
        ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
        var psKey = executeActionGet(ref).getObjectValue(charIDToTypeID("GnrP")).getBoolean(stringIDToTypeID("placeRasterSmartObject"));
        return psKey
    }
    

Maybe you are looking for