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

173
Visualizações
Error 1302:No such element Line : 8 groupChildArr[randLays].visible = true;

Hi i'm trying to run this script that I found on photoshop And It gives me this error

1

The script is supposed to make 1 random layer visible within each group I did what the post said step by step.

2 I really need help here.

function Visible() {
  var Grps = app.activeDocument.layerSets; // loops through all groups
  for (var i = 0; i < Grps.length; i++) {
    var tmp = app.activeDocument.layerSets[i].layers.length;
    app.activeDocument.layerSets[i].visible = true;
    var groupChildArr = app.activeDocument.layerSets[i].layers;
    var randLays = Math.floor(Math.random() * tmp);
    groupChildArr[randLays].visible = true;
    Save();
  }
  Revert();
}

function Save() {
  var outFolder = app.activeDocument; // psd name
  var outPath = outFolder.path;
  var fName = "PNG"; // define folder name
  var f = new Folder(outPath + "/" + fName);
  if (!f.exists) {
    f.create()
  }
  var saveFile = new File(outPath + "/" + fName + "/" + "Pattern_" + num + ".png");
  pngSaveOptions = new PNGSaveOptions();
  pngSaveOptions.interlaced = false;
  app.activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}

// Original code - revert function does not work
// for some users
//function Revert(){
//  var idslct = charIDToTypeID( "slct" );
//  var desc300 = new ActionDescriptor();
//  var idnull = charIDToTypeID( "null" );
//  var ref163 = new ActionReference();
//  var idSnpS = charIDToTypeID( "SnpS" );
//  ref163.putName( idSnpS, "test.psd" );
//  desc300.putReference( idnull, ref163 );
//  executeAction( idslct, desc300, DialogModes.NO );
//}

function Revert() {
  var idRvrt = charIDToTypeID("Rvrt");
  executeAction(idRvrt, undefined, DialogModes.NO);
}

var count = prompt("How many patterns you want", "");
for (var x = 0; x < count; x++) {
  var num = x + 1;
  Visible();
}
about 4 years ago · Juan Pablo Isaza
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