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

How to complete Image/Trap with javascript

Engaged ,
Jul 29, 2021 Jul 29, 2021

I work with CMYK images and I want to create script which will flatten layers and complete trapping 0,2mm. I tried with Script Listener and i got this code but result is slightly different when i do it manuly.

 

    var idFltI = charIDToTypeID( "FltI" );
    executeAction( idFltI, undefined, DialogModes.NO );
    // =======================================================
    var idTrap = charIDToTypeID( "Trap" );
    var desc6698 = new ActionDescriptor();
    var idWdth = charIDToTypeID( "Wdth" );
    var idRlt = charIDToTypeID( "#Rlt" );
    desc6698.putUnitDouble( idWdth, idRlt, 0.566895 );
    executeAction( idTrap, desc6698, DialogModes.NO );

 

 

TOPICS
Actions and scripting , macOS
2.7K
Translate
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

Community Expert , Jul 30, 2021 Jul 30, 2021

I would work in px and trap to the desired unit in px values.

 

// Save the current ruler units and set to pixels
var savedRuler = app.preferences.rulerUnits;        
app.preferences.rulerUnits = Units.PIXELS;

// Do your stuff...

// Restore the ruler units
app.preferences.rulerUnits = savedRuler;
Translate
Adobe
Community Expert ,
Aug 07, 2021 Aug 07, 2021

Right. Would it be possible to get the current unit setting via something like .executeActionGet()? I’m not that familiar with ActionDescriptor syntax.

Translate
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
LEGEND ,
Aug 07, 2021 Aug 07, 2021

No. You can only control user inputs by script. Anyway I repoted the bug.

Translate
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