Skip to main content
Known Participant
November 23, 2019
Answered

smart filter

  • November 23, 2019
  • 4 replies
  • 3412 views

I would like to find a way to see if I am
present in an advanced smart filter object

If smart filters are present, everything is ok
if they are not present, a warning is issued.

 

This topic has been closed for replies.
Correct answer Kukurykus

Unfortunately it's not what I'm looking for
true and false is not the solution for me
I would prefer this solution more
alert ("smart filter ok");
alert ("smart filter ko");


Are you serious? Can't you just create if / else statement yourself?

 

alert('SMART FILTER: ' + (executeActionGet(ref).getObjectValue(sTT('smartObject')).hasKey(sTT('filterFX')) ? 'ON' : 'OFF'))

 

4 replies

Known Participant
November 23, 2019

Sorry guys
it is I who am unable to understand
because I'm new to scripting
if I was good I wouldn't have asked on the forum
you can post a code that I can use
simply without my interventions

thank you both for your patience with me.

Kukurykus
Legend
November 23, 2019

If you don't delete masks from Smart Filter you can use my second code. If you do then you should use r-bin code you find in other thread he linked you to. If you still can't realise what is going on over there I updated my previous post with simpler version of his code, however all credits go to him 😉

Known Participant
November 23, 2019

Unfortunately it's not what I'm looking for
true and false is not the solution for me
I would prefer this solution more
alert ("smart filter ok");
alert ("smart filter ko");

Legend
November 23, 2019

use function

get_filter_fx_count(layer_id)  

from here https://community.adobe.com/t5/photoshop/photoshop-scripting-update-layers/m-p/9728360#M155634

 

returns 0 if there are no smart filters.

Known Participant
November 23, 2019

Mr. r-bin
I hope you can help me

My problem is this:
I have many psd files with advanced object layers
some of these have no smart filter inside

So if advanced object has internal smart filter '
Go on
if it has no smart filter it deletes the advanced object level.

Legend
November 23, 2019
Have you tried the advice from the answer above (with reference to the function)?
 
Known Participant
November 23, 2019

Kukurykus thank you for your efforts but not what I'm looking for

I don't care about the mask if it is present or not present
I'm interested in knowing if smart filters are present

therefore
if there are smart filters, leave everything ok
if no smart filter is present, a warning is issued
alert ("smart filter not present");

 

I thank you again for everything.

Kukurykus
Legend
November 23, 2019

What is the difference between SmartFilters and FilterMask ?

Known Participant
November 23, 2019

I don't care about the mask
I just want to know if the filters are present

Kukurykus
Legend
November 23, 2019

In first description you said something different than in second, so it's not clear for me what you want.

 

Anyway if you want to know if Smart Filters mask is active (ie. not present) then if you work in RGB Mode and all its channels are not deleted then this code should help you (where true is for warning):

 

sTT = stringIDToTypeID; (ref = new ActionReference()).putProperty(sTT('property'), iI = sTT('itemIndex'))
ref.putEnumerated(sTT('channel'), sTT('ordinal'), sTT('targetEnum')), alert(!(executeActionGet(ref).getInteger(iI) > 3))

 

 

 

 

Known Participant
November 23, 2019

Kukurykus you are right I did not put the question well
I don't care about the mask

I would just like to know if there are smart filters in the advanced object level or not

so I would like this feature
If smart filters are present, everything is ok
if they are not present, a warning is issued.

Kukurykus
Legend
November 23, 2019

Then false if mask is not present:

 

sTT = stringIDToTypeID; (ref = new ActionReference()).putProperty(sTT('property'), hFM = sTT('hasFilterMask'))
ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum')), alert(executeActionGet(ref).getBoolean(hFM))