• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Place image in active document 'not as smart object'

Community Beginner ,
Sep 08, 2015 Sep 08, 2015

Copy link to clipboard

Copied

How can i place an image into the active document, but not as a smart object?

TOPICS
Actions and scripting

Views

344

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Sep 08, 2015 Sep 08, 2015

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

...

Votes

Translate

Translate
Adobe
Participant ,
Sep 08, 2015 Sep 08, 2015

Copy link to clipboard

Copied

Edit > Preferences > General > Always Crete Smart Objects when Placing

placeRasterSmartObject(false);

/* Do something */

placeRasterSmartObject(true);

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);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 08, 2015 Sep 08, 2015

Copy link to clipboard

Copied

Could you demonstrate this being using with an actual image file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 08, 2015 Sep 08, 2015

Copy link to clipboard

Copied

LATEST

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

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines