# Export highlighted text from multiple RTFs?

**URL:** <https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897>\
**Category:** Automation\
**Created:** [October 21, 2014, 4:47pm UTC](https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897 "2014-10-21T16:47:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TXCiclista](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/txciclista/32/6680_2.png) [@TXCiclista](https://discourse.devontechnologies.com/u/TXCiclista)\
**Post date:** [October 21, 2014, 4:47pm UTC](https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897/1 "2014-10-21T16:47:21Z")

</div>

I have about 300 RTF docs that I have imported into Devonthink. In each file, there is at least one passage (sometimes more) that has been highlighted. At a minimum, I would like DTP to scan these RTF docs and export the highlighted text. Even better, it should include x number of preceding and following words. If I had everything I wanted, it would also append the filename somewhere before or after each quote.

I understand this may not be something that falls within the scope of DTP. If so, pointers to a third-party app (or perhaps Automator?) are welcome, especially if it can handle this sort of batch processing.

Thanks in advance.

EDIT: The highlighted text in _most_ cases has also been added to the “Comment” field in “Document Properties,” so simply exporting this field would be a start.

---

<div class="post-metadata">

**Author:** ![korm](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/k/e0b2c6/32.png) [@korm](https://discourse.devontechnologies.com/u/korm)\
**Post date:** [October 21, 2014, 6:59pm UTC](https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897/2 "2014-10-21T18:59:16Z")

</div>

There is a script in the Support Assistant that will “Merge Highlights” from RTF files into a new RTF file. (Help \> Support Assistant \> Install Extras \> Scripts \> Merge Highlights (2)) There is also a script at Scripts \> Comments \> Assemble that will merge Spotlight comments into an RTF file. Both scripts operate on the selected records. Select your RTF files and run one or the other script, then edit the result to tidy it up.

The script to merge highlights does not have your particular requirements, but you could customize the script if you feel a code coming on. 🙂

---

<div class="post-metadata">

**Author:** ![TXCiclista](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/txciclista/32/6680_2.png) [@TXCiclista](https://discourse.devontechnologies.com/u/TXCiclista)\
**Post date:** [October 21, 2014, 7:20pm UTC](https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897/3 "2014-10-21T19:20:08Z")

</div>

That is fantastic! Many thanks. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/2X/4/4e6ff70c96be2eb307a274d890bba8d71ba671b3.png) [@system](https://discourse.devontechnologies.com/u/system)\
**Post date:** [January 21, 2022, 11:22am UTC](https://discourse.devontechnologies.com/t/export-highlighted-text-from-multiple-rtfs/17897/4 "2022-01-21T11:22:36Z")

</div>


