Copy link to clipboard
Copied
I am building a customised Action in Acrobat using JS and I want to be able to import a list and iterate through it, like the built-in "Search & Remove Text" tool does. I can't figure out a way to edit the built-in tools though, or a place I can find the code behind them.
If this isn't possible, does anyone know where else I might find JS code that imports a list and iterates through it?
Any help would be very much appreciated!
Copy link to clipboard
Copied
You can't do it using JavaScript. What you can do, though, is write your own script that searches the entire document for specific phrases and then redacts them, but I should warn you that doing it with JS is much less efficient and fast than using the built-in command, so I would avoid it if possible.
Regarding the list of items: The Actions in Acrobat are defined using an XML file that contains all of the commands in them in plain-text.
The file type is "sequ" (for "sequence"). You can export an Action to a file, open it using a plain-text editor and then see the code in it.
If you do that you'll see that the list of items to redact is easily identifiable and can be expanded using relatively simple means.
After editing the sequ file simply import it back into Acrobat and you're ready to go!
Copy link to clipboard
Copied
When I export the sequ file of an Action that contains the "Search & Remove Text" tool, all that shows up in the code for that step is:
<Group label="Untitled">
<Command name="SearchAndRedactCmd" pauseBefore="false" promptUser="true"/>
</Group>
Any idea what I could do to see the list implementation you're referring to try67 ?
Copy link to clipboard
Copied
Add some items to it via the dialog window in the Action Wizard and then
examine it again.
Copy link to clipboard
Copied
Ah, I didn't think of that. Still, when I add items, I get something this:
<Group label="Untitled">
<Command name="SearchAndRedactCmd" pauseBefore="false" promptUser="false">
<Items>
<Item name="CaseSensitive" type="boolean" value="false"/>
<Item name="WholeWord" type="boolean" value="false"/>
<Items name="WordList">
<Item name="0" type="text" value="test"/>
<Item name="1" type="text" value="thing"/>
<Item name="2" type="text" value="other"/>
</Items>
</Items>
</Command>
</Group>
This still doesn't tell me how I could interact with the list at all. Any ideas how to do it or get it to show more? I really appreciate your help!
Copy link to clipboard
Copied
This is the only way you can interact with this list, outside of using Acrobat's GUI.
Maybe you should explain what exactly you're trying to achieve...
Copy link to clipboard
Copied
I'm writing my own Action using mostly JavaScript steps. I would really like to be able to have a dialogue box pop up like the one that appears when you use the "Search & Remove Text" tool, and then I want to do more than just redact that list. (I want to loop through the list of input words, and redact one at a time, do some other stuff, and then unhighlight it before moving on to the next word in the list.) Basically I have a script that takes a word as input and does everything I want, but I don't want to manually run the script 200 times entering the 200 different words I want to do it to.
Does that make sense?
Copy link to clipboard
Copied
Yes, but I don't think it will be possible, at least not in the way you describe it.
You can create your own dialog window (have a look at the documentation of the execDialog method), but it is quite limited in what it can do.
Copy link to clipboard
Copied
The Acrobat source code is highly secret, and even if it wasn't, the built in functions are not created using JavaScript. Often, make a tool "quite like another one" is a huge project, written in C, where no part of Acrobat can be used, only the low level plug-in API.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now