Copy link to clipboard
Copied
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.
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.
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'))
Copy link to clipboard
Copied
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))
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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))
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
What is the difference between SmartFilters and FilterMask ?
Copy link to clipboard
Copied
I don't care about the mask
I just want to know if the filters are present
Copy link to clipboard
Copied
Do you know what is retoricial question?
Copy link to clipboard
Copied
I thank you for your time
good day
Copy link to clipboard
Copied
I think you don't understand 😕
When you delete Smart Filters from the layer you showed on the image and run my code (that second), you're getting false. When you still have Smart Filters and run that code you're getting true.
So if FilterMask is the same as Smart Filter what I guess you already got your solution?
Copy link to clipboard
Copied
you are mistaken
Copy link to clipboard
Copied
Okey, it's why I asked what is difference between Smart Filters and FilterMask. If I know that I can know where to start. So what is that difference?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Okey, I don't know, but when I ran that code when Smart Filters is on then I get true, when Smart Filters is not present then false, so if that is not enough to know if Smart Filter is present then I ask what is wrong with that code 🙂
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The mask from channels?
EDIT: okey you are right, I removed the mask from channels and my code doesn't result as true anymore though SmartFilters are present.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
btw I ran also your code and it results as true / false depending Smart Filter is avialable, so is there really difference to get to know Smart Filter presence?
EDIT: Due to other subthread I tested SmartFilters with deleted mask and in that case scaning Smart Object would be only solution:
sTT = stringIDToTypeID; (ref = new ActionReference())
.putProperty(sTT('property'), sTT('smartObject'));
ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum'))
executeActionGet(ref).getObjectValue(sTT('smartObject')).hasKey(sTT('filterFX'))
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 😉
Copy link to clipboard
Copied
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");
Copy link to clipboard
Copied
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'))
Copy link to clipboard
Copied
Kukurykus
Gold I understand and it works great
you are a true master
thank you for everything you did for me.