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
}

Tags: Photoshop

Similar Questions

  • 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 ';

  • 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);
    
  • 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"});
    
        }
    }
    
  • I have windows 7 32-bit professional. It is said in the Activation status not available, product ID not available.

    I have windows 7 32-bit professional. It is authentic and for a few days I get the message that iI may have been a victim, and also the windows are not authentic. It is said in the Activation status not available, product ID not available. pls help

    Download and run the Microsoft Genuine Advantage Diagnostic Tool:
    http://www.Microsoft.com/genuine/selfhelp/ServiceRequest.aspx
    Download the tool: http://go.microsoft.com/fwlink/?linkid=56062
    Post your results (copy button) and paste the results in your answer.

    J W Stuart: http://www.pagestart.com

  • 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.

  • 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.

  • 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		   
  • Place the .txt document, causing problems of packaging

    I place a .txt file into a publication in InDesign. I have the text set to left justification and no hyphenation. Text is not correctly flowing with broken line breaks. For example, the first line MI to the next line breaks. I am able to type in MI immediately after Detroit but when I delete the e on the second line, the newly typed MI is broken in the second line again. If the text block is set on a complete justification, then disappear irregular breaks and MID is on line 1 with Detroit.


    A few things to note:

    -J' checked for the characters hiding and found there is only 1 space between the words where irregular Break occur

    -There is no withdrawal on text frames

    -J' use paragraph styles for formatting text

    -When you place the text, the character set is Unicode UTF8


    I don't know if it's a problem of text frame or a matter of investment. Suggestions?

    problem.png

    It's probably the paragraph composer deciding the balance of the line is better with the odd break. You can force the words stay together by using either an or No Break, that are applicable to non-breaking space.

  • InDesign CS4 crashes when you place the Word document

    Hello

    I'm having a real problem by placing a Word document in InDesign CS4. It crashes everytime! I found that if I turn off the 'import inline graphics' it correctly places the document. but enabling this option blocks InDesign.

    I tried to save in rich TEXT format and even do a simple copy - paste, but the result is the same: InDesign crashes.

    If you have an idea please let me know!

    Thank you

    Ariel

    Do you still have a CS3 lying around?

  • Close the active document without saving changes

    Hi all

    Someone at - it a script to close the current document of the acrobat form without saving changes?

    I have a script to do all the fields in a read-only form, print and then send the finished form, but would then close the document without saving changes.

    Thank you

    Simon

    this.closeDoc (true)

  • Remove the anchor object in the active document

    I have a couple of InDesign CS4 documents that a lot of objects to anchor. I want to just delete the entire anchor as well as objects using Javascript. Can someone help me on this topic?

    This can be done with a simple search and replace - see the help on the search for the code.

    You can put this find-replace in a script, or save it in the saved query list.

  • How to avoid the transparent background, white in smart object (psb) conversion when the image track high fidelity that we have the ability to ignore track of white up to 16 colors.

    I have an image psd file in photoshop cc 2014 the layer background transparent. I wanted to convert to vector. The best option I've seen was converted first to a smart object in photoshop by layer-> Smart objects-> convert to smart object. then he exported a CPS. Then I opened the file in illustrator and applied image tracking tool, but the background transparent got converted to white but I had the option to skip white up to 16 trace of color. But in the case of Conversion of high fidelity, the option do not know white is not available, what do I do now?

    After using the Trace of the Image and expand the result, just find a part that is filled with white and use Select > same > fill and just delete.

  • The PSB (textures 3D and Smart Objects) are stored in the PSD file?

    The subject line is the main issue. But I have a few other questions: the PSB files are stored (in the Windows operating system) in the folder Temp of the user. Why? My Temp folder has a dozen PSB files with various dates. Is there a reason that they do not disappear when a PSD file is saved? Remains of the PS crashes?

    Same questions for Smart Object PSB files.

    Thank you

    Jeff Sengstack

    Sengstack wrote:

    The subject line is the main issue.

    Yes, a smart object is a container for a file embedded as a PSB (large Document of Photoshop), EPS, PSD, TIFF, PDF, etc.

    Material 3D textures are incorporated in a document by using the mechanism of the SO.

    Sengstack wrote:

    PSB files are stored (in the Windows operating system) in the folder Temp of the user. Why?

    When you choose to edit a written Photoshop, SO the ER is incorporated into a temporary file and opens in a new window.

    My Temp folder has a dozen PSB files with various dates. Is there a reason that they do not disappear when a PSD file is saved? Remains of the PS crashes?

    Photoshop will normally remove the temporary file when the master document (the one containing the SO) is closed. If you wish, you can watch the creation and deletion of these files. An accident before closing the document master is expected to be the only reason that there is a PSB wandering in Temp.

Maybe you are looking for