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

how to have the actions to record the selection of an object

Community Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

hi,

i tried to pick the object on the rhs and have the action to record my selection as shown in the attached screenshot.Screen Shot 2022-06-20 at 14.45.35.png

i do not know how to have the action record this ... all the item names are <path>...

any help or comment...

thanks and cheers,

TOPICS
Scripting

Views

1.2K

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 , Jun 22, 2022 Jun 22, 2022

See if this works for you.  If it does, you can include it in your action.

app.selection = null;
var items1 = app.activeDocument.pathItems;
var items2 = [];
for (var i = 0; i < items1.length; i++) {
    if (items1[i].pathPoints.length == 4 && 
        items1[i].closed == true && 
        items1[i].stroked == true) {
            items2.push(items1[i]);
    }
}
for (var i = 0; i < items2.length; i++) {
    items2.sort(function(a, b) {
        return b.visibleBounds[2] - a.visibleBounds[2];})
}
for 
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

manually add a Note to the objects you want to select, then when you're recording the action, go to the flyout menu and click on the "Select Object..." menu item. That will select all items whose Note matches the text you provide.

attibutesNote.PNG

attibutesNote2.PNGattibutesNote3.PNG

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

this is not going to work because it only work for the files have the note of "selectMe" ... i have to add "selectMe" to every each file and it is defeating the purpose of automation using action ... if i could go to each file to add the note of "selectMe", i could also pick the object as well and no need to add the note ... i am trying to avoid the need to go for each file ... thousand of files need to add...

thanks for your comment...

cheers,

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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

well that's how you have an action select objects.

 

please describe exactly what you need to do to see if it can be done with an action.

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

carlos,

i am trying to select an object with no unique identification for reference. if i could have the action to record this selection, it allows me to do the following jobs in actions ... the problem is the action is not doing the recording ... this is the issue ... hope you understand...

cheers and 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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

Hi wong, got it. It seems you want to open a file and have an action select some objects with no unique attribute. That won't be possible with an action.

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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

Wong,

 

Looks like it is related to another request you posted a week ago, but this time even a bit more difficult to solve because you now have no uniquely named items.

 

https://community.adobe.com/t5/illustrator-discussions/how-to-write-an-action-selecting-multiple-obj...

 

At the moment it is rather difficult to provide some general way to do it. Probably not possible at all.

 

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

kurt,

you are correct ... i did submit a request a week ago and resolved ... this time the files have NO unique names, they are all identified as <path>, this is why i submit the request again ... hopfully, to get a solution with no particular requirement to resolve the issue...

thanks and cheers,

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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

Wong,

 

guess you are dealing with a great number of files, searching for some general way to select the desired objects.

 

Unfortunately, that may either be impossible or at least very difficult if there are no unique attributes or named items in order to locate the objects that are going to be selected.

 

You may provide 10 or 20 sample Illustrator files for inspection. Include clear instructions that explain which objects have to be selected with an action.

 

Perhaps there is some way. And perhaps not.

 

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

kurt,

all the files are identical as i posted in my first post, there are only two objects the cap on the rhs and the shirt on the lhs ... the colors will be different and the pattern inside the object might be different...

i try to pick the cap on the rhs using the selection tool, but the recording is not working ... it is recording if i select "all on the active artboard" ... but it is not recording if i select only one of two objects...

thanks for your comment ... cheers,

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 ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

You could potentially target them with a script.  In this case, they are the first nine pathItems in a ?groupItem named "surface0".

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

femkeblanco,

it is not always the first nine pathitems, it might be more or it be less, depends on the pattern inside the cap...

the order might also change ... not always the first 9, it might be first 4 and skip 2 or 3, and the next 1 or 2 ...

so it is different in order and numbers...

thanks for your comment...

cheers,

 

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
Advocate ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

Looks like you missed Kurt Golds post.

 

Post enough examples to find common ground.

Are these all circles or are the paths made up of x anchor points? How do you identify the objects to delete?

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 Beginner ,
Jun 20, 2022 Jun 20, 2022

Copy link to clipboard

Copied

the pattern could be a star, triangle, diamond, or else ... no fix pattern and fix anchors points ... this is the problem the action is not recording my selection ... i can not select any object to be recorded in the action...

thanks and cheers,

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

Please create and upload sample files.

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

Hi Wong,

how would you decide what you want to select?

If you could make out a rule and you would be able to describe it in detail, that task would be perhaps automatable.

But I assume you'd need machine learning for this.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

 

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 Beginner ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

uwe,

i do not understand your question ... i said it in the first post that i need to pick the object on the right hand side ... it is the cap object ... it is decided and it is for every file ... it is to pick the cap object... hope you understand ... no need to decide...

i can pick the object ... but the problem is the action is not recording the pick i selected ... this is the issue ... how could you have the action to record this pick...

the action records if you select to pick "all in the active artboard" ... but it is not recording if you only pick one of the two objects in my case ... it is working in the photoshop action, it records the pick without problem ... but it is not working in illustrator ... why adobe can not make both photoshop and illustrator to work the same?...

hope you could come up a solution for me in illustrator...

thanks and cheers,

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

Hi Wong,

I fully understand you…

 

For you it's crystal clear what to select.

 

Well, we could perhaps rephrase the task:

Select objects that are stacked and are in a particular area of the artboard. No?

If that's the solution one could script it.

 

Or is it: Select objects that are not a jacket object.

How would Illustrator know what parts do constitute "jacketness" of shapes?

 

Do you now see the problem?

 

Best,
Uwe Laubender
( Adobe Community Professional )

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

Wong,

 

You were politely asked to provide sample Illustrator files including instructions a couple of times. There are valid reasons why that is pretty important in order to give further advice.

 

Is there any reasonable reason why you (obviously) don't want to do that?

 

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

Are the items comprising the shirt/jacket always six? (If so, items other than the left-most six items can be targeted with a script.) This is not to distract from the repeated requests for sample Illustrator files.

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 Beginner ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

femkeblanco,

it is not always six ... there is no pattern in this shirt ... there might be pattern in the shirt like star, circle, or else...20220621.png20220622.png20220623.png20220624.png20220625.png20220626.png20220627.png

i have selected the cap in all seven files i have attached for your reference...

thanks & cheers,

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 ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

OK. The least common denominator of the items you want to select seems to be that they lie within the bounds of the largest circle in the document. Will a circle on a shirt ever be larger than the circle which makes up the cap?

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 Beginner ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

yes,

a single circle on the shirt will be larger than the circle for the cap ... i have attached for your reference...

but it only happen for a few times and i could manually handle these files...

Screen Shot 2022-06-21 at 20.12.41.png

thanks & cheers,

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 ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

See if this works for you.  If it does, you can include it in your action.

app.selection = null;
var items1 = app.activeDocument.pathItems;
var items2 = [];
for (var i = 0; i < items1.length; i++) {
    if (items1[i].pathPoints.length == 4 && 
        items1[i].closed == true && 
        items1[i].stroked == true) {
            items2.push(items1[i]);
    }
}
for (var i = 0; i < items2.length; i++) {
    items2.sort(function(a, b) {
        return b.visibleBounds[2] - a.visibleBounds[2];})
}
for (var i = 0; i < items1.length; i++) {
    var b1 = items1[i].visibleBounds;
    var b2 = items2[0].visibleBounds;
    var x = items2[0].width / 2;
    var y = items2[0].height / 2;
    if ((b1[0] > b2[0] && b1[2] < b2[2] + x) && 
        (b1[1] < b2[1] && b1[3] > b2[3] - y)) {
            items1[i].selected = true;
    }
}
items2[0].selected = true;

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 Beginner ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

femkeblanco,

i will try it out and let you know the result ... thanks for spending so much time to help me ... appreciated your effort...

cheers,

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