Place image in active document 'not as smart object'
How can i place an image into the active document, but not as a smart object?
How can i place an image into the active 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
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.