Rasterize all Smart Objects, except the ones with Smart Filters - Script

Explorer ,
Feb 24, 2022 Feb 24, 2022

Copy link to clipboard

Copied

Hi guys! I found some scripts to rasterize all smart objects, but they rasterize them all without exception. I need a script that rasterizes all smart objects, except those that have smart filters applied. Is it possible using scripts?

 

Thanks!

TOPICS
Actions and scripting

Views

81

Likes

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

Adobe Community Professional , Feb 24, 2022 Feb 24, 2022
#target photoshop s2t = stringIDToTypeID; (r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers')); r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum')); var len = executeActionGet(r).getInteger(p), lrs = []; for (var i = 1; i <= len; i++) { (r = new ActionReference()).putProperty(s2t('property'), p = s2t('layerKind')); r.putIndex(s2t('layer'), i); if (executeActionGet(r).getInteger(p) == 5) { (r = new ActionReference()).putProperty...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 24, 2022 Feb 24, 2022

Copy link to clipboard

Copied

 

#target photoshop
s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p), lrs = [];
for (var i = 1; i <= len; i++) {
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('layerKind'));
    r.putIndex(s2t('layer'), i);
    if (executeActionGet(r).getInteger(p) == 5) {
        (r = new ActionReference()).putProperty(s2t('property'), p = s2t('smartObject'));
        r.putIndex(s2t('layer'), i);
        if (!executeActionGet(r).getObjectValue(p).hasKey(s2t('filterFX'))) lrs.push(i)
    }
}
if (lrs.length) {
    var r = new ActionReference()
    for (var i = 0; i < lrs.length; i++) r.putIndex(s2t('layer'), lrs[i]);
    (d = new ActionDescriptor()).putReference(s2t('target'), r);
    executeAction(s2t('select'), d, DialogModes.NO);
    (r = new ActionReference()).putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
    (d = new ActionDescriptor()).putReference(s2t('target'), r);
    executeAction(s2t('rasterizeLayer'), d, DialogModes.NO);
}

 

Likes

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
Explorer ,
Feb 24, 2022 Feb 24, 2022

Copy link to clipboard

Copied

LATEST

Worked perfectly! Thank you!

Likes

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