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

Is there an attribute that can determine whether an object has an "effect" or opacity applied?

Contributor ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Is there an attribute (Boolean Value) that can determine whether an object has an "effect" or opacity applied(object elements marked as "solid circle" on the layer)?

 

RaymondZJH_0-1652432557739.png

For the opacity, pathItem.opacity attribute only access the opacity of the whole object, not the opacity with details.

 

Set doc = app.ActiveDocument
For Each Obj In doc.pageitems
If Obj.Opacity < 100 Then
MsgBox "Have an effect applied!" & " " & TypeName(Obj) & " " & Obj.Opacity
End If
Next

 

RaymondZJH_1-1652432865659.pngRaymondZJH_2-1652432902586.png

 

TOPICS
Scripting

Views

1.4K

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

Guide , May 16, 2022 May 16, 2022

@Raymond ZJH  "expandStyle" corresponds to Object > Expand Appearance in the menu bar. Expand Appearance, as the name implies, expands the appearance of a path with an appearance attribute (effect or transparency), producing a group (representing the stroke and the fill). The script tests whether or not a path's appearance is expandable.

 

The script works as follows:  You're asked to select a path. This path is duplicated. The duplicate is selected. Expand Appearance is invoked. At this point, if

...

Votes

Translate

Translate
Adobe
Community Expert ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

No.

Unfortunately, we have no access to the appearance palette.

 

(I hope one day someone can tell us something more encouraging.)

Votes

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
Community Expert ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

After re-reading your post: do you want to set the attributes or read them?


There is a workaround for setting such attributes. Apply an existing graphic style with these attributes.

However, you cannot read these attributes.

Votes

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
Contributor ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Thanks  @pixxxelschubser 

 

I want to find out these object elements with effects (including opacity) applied, and then cancel these effects. If there is no script method to cancel these effects, I can move them to the same layer, and then manually execute the "clear appearance" command of the appearance panel (this is a compromise, if the script cannot be completed at one time), But the premise of doing this is to be able to identify these object elements with effects applied (the effects applied are not all the same. If they are the same, I can use the "select the same appearance" command). So I hope the script hava an attribute(Boolean Value). When the effect is applied, the value is True, otherwise it is False.
Because a file includes many, many object elements, if I manually search one by one, it is a very crazy , and the search is not comprehensive...

Votes

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
Community Expert ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

As I wrote before: However, you cannot read these attributes.

Sorry

Votes

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
Guide ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

This is a basic idea for a function to test whether or not a path item has an effect or transparency.

// select path item
alert(test(app.selection[0]));

function test (path1) {
    var path2 = path1.duplicate();
    app.selection = null;
    path2.selected = true;
    app.executeMenuCommand("expandStyle");
    var hypothesis = app.selection[0].typename;
    app.selection[0].remove();
    return hypothesis == "GroupItem";
}

Votes

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
Contributor ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

Hi, @femkeblanco 

 

Where is the "expandStyle" command from illustrator menu?

Can you briefly explain the meaning of this script? Maybe it can't completely solve the problem, but maybe I can get some inspiration from it, because I'm a novice for JS. Thank you!

Votes

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
Guide ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

@Raymond ZJH  "expandStyle" corresponds to Object > Expand Appearance in the menu bar. Expand Appearance, as the name implies, expands the appearance of a path with an appearance attribute (effect or transparency), producing a group (representing the stroke and the fill). The script tests whether or not a path's appearance is expandable.

 

The script works as follows:  You're asked to select a path. This path is duplicated. The duplicate is selected. Expand Appearance is invoked. At this point, if the item which is selected is a group, the path's appearance is expandable, i.e. there is an effect or transparency. In the end, the duplicate is removed.

 

The script has it's drawbacks. First is runtime, as @pixxxelschubser  points out. This is particularly relevant if you want to test nested items, which will add (probably unmanageable) complexity to an already sluggish script. Second, if a path has either a stroke or a fill but not both, expanding appearance will not produce a group. Odd effects will also not produce a group, giving a false negative.

 

On a positive note, a similar approach has worked for my needs in the past. 

Votes

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
Contributor ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

 

@femkeblanco , Thank you for your explanation! Yes, this is also a flexible method. Although it has its drawbacks, it reflects a good programming idea (when the front can't go down, think about whether it can start from the side), thanks.

Votes

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
Community Expert ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

Hi @femkeblanco 

in theory this seems to be a solution.

 

I tried something similar in the past.

 

But it will only works for a small test file with only a few items. Try it with a "normal" file with thousands of paths, nested groups, clipping masks, opacity masks, gradients with ramp stops which have transparency, layers with transparency or blend modes.

 

There are so many scenarios which will fail. And on the other side: because of the high amount of paths Illustrator probably seems to freeze and if it won't crash - the execution time will be absolutely unpracticable.

Votes

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
Guide ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

@pixxxelschubser  I agree.  I just thought I'd throw it out there. 

Votes

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
Community Expert ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

You may provide one of the rather complex Illustrator files for inspection.

 

Perhaps there are some other ways without using scripts.

 

Votes

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
Participant ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

Huh?

FindEffects.gif

Votes

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
Community Expert ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

tomr,

 

I'm not quite sure about your "Huh?" message and don't get what the animation is actually supposed to show and mean.

 

Also, I'm not sure if you understood the possible issues in this context. At least I don't think that a (basically useful) plugin - one that you obviously do recommend - can help when it comes to nested instances of transparency inside type objects that Raymond mentioned.

 

Votes

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
Participant ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

The context is quite simple: that guy has issues with effects and transparencies. He can fix effects issues with the plugin. But obviously he can't fix transparencies issues with the plugin.

Votes

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
Community Expert ,
May 14, 2022 May 14, 2022

Copy link to clipboard

Copied

Possibly the context is as simple as you claim now, but I wouldn't be sure about that as long as there is no sample file available for inspection.

 

Apart from that, perhaps he is using the Mac version of Illustrator. Then the plugin would be completely useless.

 

Votes

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
Community Expert ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

he isn't just "having issues with effects and transparencies". the question was about how to programmatically search each item and remove certain effects. 

 

the plugin you showed looks like it works great for manually clicking on an item and then viewing the effects in the plugin... but if you're manually doing that, then the appearance panel would suffice.

 

The issue is programmability. 

Votes

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
Contributor ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Hi, @Disposition_Dev 

I was surprised to see you enter. I have seen many very professional replies from you, when I first contacted this forum to find some answers, you're on my follow list.

Votes

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
Community Expert ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Thanks for the kind words. I wish I had a solution for you on this one.. But unfortunately I'm in the "yea Adobe doesn't let us do that" camp. There's a frustrating number of things available in the UI that simply have no support via scripts and for the life of me I can't understand why.

 

Adobe, if you're listening... I understand if you just don't have the staff on board to make it happen.. You know where to find me. I'll come help. 😉 

Votes

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
Contributor ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

Hi, @tomr11694738 

 

Can you tell me where I can find this plug-in? thanks.

Votes

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
Contributor ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

I have found it in Google.

 

Unfortunately, it does not detect objects with opacity.....

Votes

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
Community Expert ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Raymond,

 

you may still want to share at least one or two of your rather complex files with nested instances of transparencies (and possibly other effects).

 

Otherwise it is rather difficult to think about possible solutions (or solutions which may work just partially).

 

Votes

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
Contributor ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Hi @Kurt Gold 

Thank you for following my post. But I'm sorry, I can't upload these files, because my network environment doesn't allow me to do so. Even when I visit this forum, I have many twists and turns, and sometimes I can't access it directly. It's inconvenient to talk about the specific reasons here.
In addition, I don't think it's good to make a direct solution to individual documents, which may be incomplete, because each document is different. As you and pixxxelschubser mentioned, there are many forms of effect and opacity. I don't know which effects are used in each file, because these files are sent to me by my customers. What I need to do is to typeset and output these files, but the output device does not support these effects and opacity, otherwise all output colors will be seriously lost, not just these elements with effects or opacity applied, so I need to deal with these elements. When I can't find all the elements, I can only rasterize the whole file and then output it, but this has a loss of quality. It's more obvious when I output a large area.

Votes

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
Community Expert ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

LATEST

I understand.

 

The reason, however, why I'm asking for sample files is not because I (or someone else) may just want to see and create a possibly instant solution for just the specific sample files. No, the main reason is because it is almost always useful and helpful to inspect real files. This way, one can, for instance, exclude certain improbable, though possible scenarios like quadruple or quintuple nested constructions with different transparencies at different object levels. And perhaps the files do not contain as many extremely nested appearances as one may assume sometimes. Who knows?

 

As already mentioned, I can imagine some ways to solve or partially solve your task with some built-in procedures. However, if it is difficult or impossible for you to share a couple of sample Illustrator files, I'm afraid you will have to look out for some other ways to ease the issues.


I am sorry, but without sample files I will not follow up the matter.

 

Votes

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