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

183
Visualizações
how to get offset information of a crop/selection area in photoshop script?

When I use "DialogModes.ALL" to create a crop area,

How to get offset information after crop/selection action done by human in photoshop script ?

thanks :)

var idCrop = charIDToTypeID( "Crop" );
var desc22 = new ActionDescriptor();
var idT = charIDToTypeID( "T   " );
    var desc23 = new ActionDescriptor();
    var idTop = charIDToTypeID( "Top " );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc23.putUnitDouble( idTop, idPxl, 0.000000 );
    var idLeft = charIDToTypeID( "Left" );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc23.putUnitDouble( idLeft, idPxl, 66.000000 );
    var idBtom = charIDToTypeID( "Btom" );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc23.putUnitDouble( idBtom, idPxl, 1536.000000 );
    var idRght = charIDToTypeID( "Rght" );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc23.putUnitDouble( idRght, idPxl, 1602.000000 );
var idRctn = charIDToTypeID( "Rctn" );
desc22.putObject( idT, idRctn, desc23 );
var idAngl = charIDToTypeID( "Angl" );
var idAng = charIDToTypeID( "#Ang" );
desc22.putUnitDouble( idAngl, idAng, 0.000000 );
var idDlt = charIDToTypeID( "Dlt " );
desc22.putBoolean( idDlt, false );
var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
var idtargetSize = stringIDToTypeID( "targetSize" );
desc22.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idtargetSize );
var idWdth = charIDToTypeID( "Wdth" );
var idPxl = charIDToTypeID( "#Pxl" );
desc22.putUnitDouble( idWdth, idPxl, 800.000000 );
var idHght = charIDToTypeID( "Hght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc22.putUnitDouble( idHght, idPxl, 800.000000 );
var idRslt = charIDToTypeID( "Rslt" );
var idRsl = charIDToTypeID( "#Rsl" );
desc22.putUnitDouble( idRslt, idRsl, 0.000000 );
executeAction( idCrop, desc22, DialogModes.ALL );

Where Can I insert a function for catch the offset information after crop action done by human?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You're code makes no sense, but if you want the selection bounds you'll need a function like this:

var sb = selection_bounds();


function selection_bounds()
{
   try
   {
      var x =  app.activeDocument.selection.bounds[0];
      var y =  app.activeDocument.selection.bounds[1];
      var x1 = app.activeDocument.selection.bounds[2];
      var y1 = app.activeDocument.selection.bounds[3];

      var selectionBounds = [x, x1, y, y1];

      alert(selectionBounds);
      return selectionBounds;
   }
   catch (eek)
   {
      alert("no selection");
   }
}
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