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

Resize and Crop (OK) or... just Crop (error)

Enthusiast ,
Aug 19, 2011 Aug 19, 2011

Copy link to clipboard

Copied

I use this function to resize a selection and to stop (DialogModes.ALL) on the resize object.

When it's done, just dobble-click it and that's it.

But...

some times I just don't want to make any change to resize and I just go directly to the dobble-click: this generates an error and doesn't crop.

It forces me to resize even when I don't want to.

Can you help me?

//select something

cropDialog();

function cropDialog() {
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc19 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref11 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idfsel = charIDToTypeID( "fsel" );
            ref11.putProperty( idChnl, idfsel );
        desc19.putReference( idnull, ref11 );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc19.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc20 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc20.putUnitDouble( idHrzn, idPxl, 0.000000 );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc20.putUnitDouble( idVrtc, idPxl, 0.000000 );
        var idOfst = charIDToTypeID( "Ofst" );
        desc19.putObject( idOfst, idOfst, desc20 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc19.putUnitDouble( idWdth, idPrc, 100.000000 );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc19.putUnitDouble( idHght, idPrc, 100.000000 );
        var idLnkd = charIDToTypeID( "Lnkd" );
        desc19.putBoolean( idLnkd, true );
    executeAction( idTrnf, desc19, DialogModes.ALL ); // em vez de DialogModes.NO, ou seja, para parar
}

TOPICS
Actions and scripting

Views

892

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

Valorous Hero , Aug 19, 2011 Aug 19, 2011

Change..


executeAction( idTrnf, desc19, DialogModes.ALL );


To


try{

executeAction( idTrnf, desc19, DialogModes.ALL );

}catch(e){}

Votes

Translate

Translate
Adobe
Valorous Hero ,
Aug 19, 2011 Aug 19, 2011

Copy link to clipboard

Copied

Change..


executeAction( idTrnf, desc19, DialogModes.ALL );


To


try{

executeAction( idTrnf, desc19, DialogModes.ALL );

}catch(e){}

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
Guru ,
Aug 19, 2011 Aug 19, 2011

Copy link to clipboard

Copied

Is that all of your code?. What you posted is just a transform selection function, it doesn't crop. However if you want to be able to accept the current selection without resizing just put the executeAction in a try/catch block.

cropDialog();
function cropDialog() {
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc19 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref11 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idfsel = charIDToTypeID( "fsel" );
            ref11.putProperty( idChnl, idfsel );
        desc19.putReference( idnull, ref11 );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc19.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc20 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc20.putUnitDouble( idHrzn, idPxl, 0.000000 );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc20.putUnitDouble( idVrtc, idPxl, 0.000000 );
        var idOfst = charIDToTypeID( "Ofst" );
        desc19.putObject( idOfst, idOfst, desc20 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc19.putUnitDouble( idWdth, idPrc, 100.000000 );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc19.putUnitDouble( idHght, idPrc, 100.000000 );
        var idLnkd = charIDToTypeID( "Lnkd" );
        desc19.putBoolean( idLnkd, true );
     try{
         executeAction( idTrnf, desc19, DialogModes.ALL ); // em vez de DialogModes.NO, ou seja, para parar
     }catch(e){}
}

But it still will not crop without additional code.

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
Enthusiast ,
Aug 23, 2011 Aug 23, 2011

Copy link to clipboard

Copied

LATEST

It is not all the code. I have passed only a portion.

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