Copy link to clipboard
Copied
I have an issue with looping multi-selected items these items are texts, paths and groups I'm trying to figure it out how to loop through all of these types like over again whenever they have a child " grouped to apply an action like changing the fill
function loop(){
var sel = app.activeDocument.selection;
var calltype;
for (var i = 0; i < sel.length; i++) {
alert(sel.typename);
switch (sel.typename) {
case "TextFrame":
//loopTextFeame(sel);
break;
case "PathItem":
//loopTextFeame(sel);
break;
case "CompoundPathItem":
loopCompoundPathItem(sel);
break;
case "GroupItem":
//loopTextFeame(sel);
break;
}
}
}
function loopCompoundPathItem(obj){
for (var i = 0; i < obj.groupItems.length; i++) {
alert(obj.typenames)
switch (obj.typename) {
case "TextFrame":
//loopTextFeame(sel);
break;
case "PathItem":
//loopTextFeame(sel);
break;
case "CompoundPathItem":
loopCompoundPathItem(obj);
break;
case "groupItems":
loopCompoundPathItem(obj);
break;
case "GroupItem":
//loopTextFeame(sel);
break;
}
}
}
this helps https://forums.adobe.com/thread/445843
Copy link to clipboard
Copied
I have an issue with looping multi-selected items these items are texts, paths and groups I'm trying to figure it out how to loop through all of these types like over again whenever they have a child " grouped to apply an action like changing the fill
function loop(){
var sel = app.activeDocument.selection;
var calltype;
for (var i = 0; i < sel.length; i++) {
alert(sel.typename);
switch (sel.typename) {
case "TextFrame":
//loopTextFeame(sel);
break;
case "PathItem":
//loopTextFeame(sel);
break;
case "CompoundPathItem":
loopCompoundPathItem(sel);
break;
case "GroupItem":
//loopTextFeame(sel);
break;
}
}
}
function loopCompoundPathItem(obj){
for (var i = 0; i < obj.groupItems.length; i++) {
alert(obj.typenames)
switch (obj.typename) {
case "TextFrame":
//loopTextFeame(sel);
break;
case "PathItem":
//loopTextFeame(sel);
break;
case "CompoundPathItem":
loopCompoundPathItem(obj);
break;
case "groupItems":
loopCompoundPathItem(obj);
break;
case "GroupItem":
//loopTextFeame(sel);
break;
}
}
}
this helps https://forums.adobe.com/thread/445843
Copy link to clipboard
Copied
this helps https://forums.adobe.com/thread/445843
Copy link to clipboard
Copied
another good source (for pre CS6) http://cy.cyworld.com/home/24313188/post/2801831
or with CS6+ also should help:
app.executeMenuCommand ('ungroup');
Have fun
Copy link to clipboard
Copied
I won't ungroup them. i was about to apply an action on all of the found objects text shapes groups and items under etc...
that post helps a lot
you can repeat this code for each object type you want to apply action on!
by changing textFrames to pathItems for example
if (groupRef.textFrames.length > 0) {
for (var i = 0 ; i < groupRef.textFrames.length; i++) {
textItemsList.push (groupRef.textFrames)
}
}
Copy link to clipboard
Copied
The link in the correct answer (https://forums.adobe.com/thread/445843) doesn't link properly, it takes me to Adobe's community home page (https://community.adobe.com/). How can I find the helpful answer that used to live at the above link?