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

Action / condition pour objet dynamique

Explorer ,
Oct 15, 2024 Oct 15, 2024

Hello Hello,

 

Dans les "Actions", ce serait intéressant de rajouter une condition " si le calque est un objet dynamique", cela permettrait de pouvoir l'éditer, le pixeliser, choisir une composition de calque....

 

je croise les doigts...

 

Merci !

Idea No status
TOPICS
Actions and scripting , macOS , Windows
376
Translate
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 2 Correct answers

Community Expert , Oct 15, 2024 Oct 15, 2024

I have added 3 more conditional scripts for Embedded Smart Object, Linked Smart Object & Generative Smart Object:

 

https://snipit.io/collections/22660/22660/90260

 

//////////////////////////////////////////
// Script Name: Conditionals - Run Action If Active Layer is an Embedded Smart Object Layer.jsx
// Version: 1.0
// Author: Stephen Marsh
// Usage: Runs a named Action if the active layer is an embedded smart object layer
//////////////////////////////////////////
#target photoshop
if (app.a
...
Translate
Community Expert , Oct 15, 2024 Oct 15, 2024

@Laofey – I have added my vote for a condition to be added for a smart object layer!

 

Smart object layers can have various sub-types:

 

  • Embedded Smart Object
  • Linked Smart Object
  • Generative Smart Object

 

P.S. You can vote on a related request here:

 

https://community.adobe.com/t5/photoshop-ecosystem-ideas/update-conditional-actions/idi-p/13323648

 

Translate
8 Comments
Community Expert ,
Oct 15, 2024 Oct 15, 2024

@Laofey – I have added my vote for a condition to be added for a smart object layer!

 

Smart object layers can have various sub-types:

 

  • Embedded Smart Object
  • Linked Smart Object
  • Generative Smart Object

 

P.S. You can vote on a related request here:

 

https://community.adobe.com/t5/photoshop-ecosystem-ideas/update-conditional-actions/idi-p/13323648

 

Translate
Report
Community Expert ,
Oct 15, 2024 Oct 15, 2024

I have created various simple javascripts to do "one simple thing" that is missing from Actions or Conditional Actions:

 

https://prepression.blogspot.com/2022/11/photoshop-action-helper-scripts.html

 

I just created a new one for you to run an action if a layer is a smart object layer:

 

Conditionals - Run Action If Active Layer is a Smart Object Layer.jsx

 

https://snipit.io/public/collections/22660/22660/90257

 

//////////////////////////////////////////
// Script Name: Conditionals - Run Action If Active Layer is a Smart Object Layer.jsx
// Version: 1.0
// Author: Stephen Marsh
// Usage: Runs a named Action if the active layer is a smart object layer
//////////////////////////////////////////
#target photoshop
if (app.activeDocument.activeLayer.kind === LayerKind.SMARTOBJECT) {
    // Change the Action and Action Set name as required
    app.doAction("Action 1", "Action Set 1");
} else {
    // Uncomment the following line and modify the names as required
    //app.doAction("Action 1", "Action Set 2");
}
//////////////////////////////////////////

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Translate
Report
Community Expert ,
Oct 15, 2024 Oct 15, 2024

I have added 3 more conditional scripts for Embedded Smart Object, Linked Smart Object & Generative Smart Object:

 

https://snipit.io/collections/22660/22660/90260

 

//////////////////////////////////////////
// Script Name: Conditionals - Run Action If Active Layer is an Embedded Smart Object Layer.jsx
// Version: 1.0
// Author: Stephen Marsh
// Usage: Runs a named Action if the active layer is an embedded smart object layer
//////////////////////////////////////////
#target photoshop
if (app.activeDocument.activeLayer.kind === LayerKind.SMARTOBJECT) {
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var layerDesc = executeActionGet(ref);
    ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
    var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
    if (so.getBoolean(stringIDToTypeID("linked")) === false) {
        // Change the Action and Action Set name as required
        app.doAction("Action 1", "Action Set 1");
    } else {
        // Uncomment the following line and modify the names as required
        //app.doAction("Action 1", "Action Set 2");
    }
}
//////////////////////////////////////////

 

//////////////////////////////////////////
// Script Name: Conditionals - Run Action If Active Layer is a Linked Smart Object Layer.jsx
// Version: 1.0
// Author: Stephen Marsh
// Usage: Runs a named Action if the active layer is a linked smart object layer
//////////////////////////////////////////
#target photoshop
if (app.activeDocument.activeLayer.kind === LayerKind.SMARTOBJECT) {
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var layerDesc = executeActionGet(ref);
    ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
    var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
    if (so.getBoolean(stringIDToTypeID("linked")) === true) {
        // Change the Action and Action Set name as required
        app.doAction("Action 1", "Action Set 1");
    } else {
        // Uncomment the following line and modify the names as required
        //app.doAction("Action 1", "Action Set 2");
    }
}
//////////////////////////////////////////

 

//////////////////////////////////////////
// Script Name: Conditionals - Run Action If Active Layer is a Generative Fill Smart Object Layer.jsx
// Version: 1.0
// Author: Stephen Marsh
// Usage: Runs a named Action if the active layer is a generate fill smart object layer
//////////////////////////////////////////
#target photoshop
if (app.activeDocument.activeLayer.kind === LayerKind.SMARTOBJECT) {
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var layerDesc = executeActionGet(ref);
    ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));
    var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
    if (soMoreDesc.hasKey(stringIDToTypeID('generativeDocInfo')) === true) {
        // Change the Action and Action Set name as required
        app.doAction("Action 1", "Action Set 1");
    } else {
        // Uncomment the following line and modify the names as required
        //app.doAction("Action 1", "Action Set 2");
    }
}
//////////////////////////////////////////
Translate
Report
New Here ,
Oct 15, 2024 Oct 15, 2024

thank you very helpful answer

Translate
Report
Community Expert ,
Oct 15, 2024 Oct 15, 2024

One of the most desired conditions for many is to be able to do things based on pixel dimensions. I have never seen anything similar offered or requested. For example: if the document width is greater than...

Translate
Report
Community Expert ,
Oct 15, 2024 Oct 15, 2024
quote

One of the most desired conditions for many is to be able to do things based on pixel dimensions. I have never seen anything similar offered or requested. For example: if the document width is greater than...

 

@Bojan Živković – Agreed it would be fantastic to expand on Conditional Actions by adding the ability to add operators and parameters to them. This would require a new GUI feature so that one could pick an operator or combinations of operators < + * / > = either as symbols or text (greater than etc) and a value "50" or "50px" or another operand such as Document Width, Document Height etc.

 

Such would bring the basic power of scripting in a limited form to the masses! This was the whole idea of starting the Photoshop Action Helper Scripts...

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/photoshop-action-helper-scripts/td-p/...

 

Translate
Report
Community Expert ,
Oct 17, 2024 Oct 17, 2024

En Javascript c'est possible. Par contre l'enregistrement des actions n'intègre pas encore à ma connaissance d'instructions conditionnelles.

On pourrait par contre inclure dans l'action la conversion en objet dynamique. Il faudrait tester le cas ou le calque en est dejà un…

Translate
Report
Explorer ,
Oct 20, 2024 Oct 20, 2024
LATEST

Thanks a lot Stephen; I'm not using jsx often.. Very inspiring !
hope Adobe will be inspired too 🙂

 

Translate
Report