Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

91
Visualizações
Illustrator Script- Java script- Applying action to selection

I'm trying to make a script that will go through the selection and apply action to each group in the selection.

Here is what I'm trying to do:

  1. select a couple of individual groups
  2. apply an action to each group seperatly

My problem is that instead of applying it to each group it does it to all of them. I tried using a for loop but it didn't worked, I tried to deselect the group that passed the action but it failed to.

Here is my script:

var doc = app.activeDocument;

for (i=0; i < doc.groupItems.length; i++)
{
    doc.groupItems[i].selected = true;
    app.doScript("300", "Set 1"); //Action name - Folder Name
    app.activeDocument.selection = null;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try this:

var sel = app.selection;
app.activeDocument.selection = null;

for (var i = 0; i < sel.length; i++) {
    if (sel[i].constructor.name != 'GroupItem') continue;
    sel[i].selected = true;
    app.doScript("300", "Set 1"); // Action name - Folder Name
    sel[i].selected = false;   
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda