Not yet rated

Problem

Typically, you'd need to open up each redaction annotation's properties dialog to change or set the redaction code one at a time. This can be tedious and time consuming.

Solution

With just a few lines of JavaScript, you can dramatically reduce the number of steps.

Detailed explanation

You can either copy the source code out of this page and save it to a folder level JavaScript or go here to download it and see installation instructions.

Basically, this script will create a new toolbutton for each item in the "codeArray". When one of those toolbuttons is clicked, the selected annotations' overlayText property will be changed to be the same as the toolText propperty of the toolbutton.

codeArray = ["(b) (1) (A)", "(b) (1) (B)", "(b) (2)"]

function switchRedactionCodeTo(newCode)
{
        this.syncAnnotScan();
        if (this.selectedAnnots)
                {
                        for each (annot in this.selectedAnnots)
                                {
                                        if (annot.type == "Redact")
                                                {
                                                       
annot.overlayText = newCode;
                                                }
                                }
                }
        else
                {
                        app.alert("no annotations are selected")
                }
}

for each (code in codeArray)
{
        app.addToolButton({
                cName: code,
                cExec: "switchRedactionCodeTo('"+code+"')",
                cTooltext: code,
                cEnable: "event.rc = (app.doc != null)"
        });
        
}

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes