I use PDF Expert (it could be any other PDF app, like Adobe Acrobat, etc) to annotate PDFs, and then export the annotations to a Markup (or text) file which I keep as a summary.
Unfortunately, the annotations summaries end up being too detailed as per below, which makes them tedious to read.
I am referring to the extra information: Highlight [page x]: where x is the page number.
There is no option in the PDF apps not to display the extra info.
Would there be a way to write a macro which would delete all the Highlight [page x]: text throughout the file ?
Highlight [page 1]: Effectiveness of Measures to Eradicate Staphylococcus aureus Carriage in Patients with Community-Associated Skin and Soft Tissue Infections:
Highlight [page 1]: BackgroundâDespite a paucity of evidence, decolonization measures are prescribed for outpatients with recurrent Staphylococcus aureus skin and soft tissue infections (SSTI).
Highlight [page 1]: Participants were randomized to receive no therapeutic intervention (controls) or perform one of three 5-day regimens: 2% mupirocin ointment applied to the nares twice daily, intranasal mupirocin plus daily 4% chlorhexidine body washes, or intranasal mupirocin plus daily dilute bleach water baths.
It's the two Search and Replace actions that do the work. Normally I'd explain the regular expressions, but they're too long. So instead, here's the links to these examples on regex101.com:
Hello Dan,
The macro works perfectly. If I want to create a duplicate macro with a small variation:
1- I would trigger the macro within the markdown or text file itself to clean it up.
2- there are some other annotations where instead of âhighlightâ (as in âHighlight [page 1]:â) , itâs just another type of text, like Rectangle [page 1]:which is no problem. I can adapt your reg formula and simply change Highlight for Rectangle. My question is how to structure the macro in such a way that I could automatically do a series of search and replaces.
thanks very much
Create a macro group that is active when the editor you're using is the front (active) application.
Create a macro in that group that does the following:
a. Select all
b. Copy
c. Do the search and replace, against the clipboard instead of a variable
d. Paste
Give yourself some way to trigger the macro. HotKey, Palette, Status Menu, etc.
My question is how to structure the macro in such a way that I could automatically do a series of search and replaces.
In "2. c." above, just have multiple Search and Replace actions for each condition, or get creative and modify the regular expression to support multiple conditions (probably more work than it's worth).
I'm intentionally not writing the entire thing for you, for these reasons:
If you know how to do it, I'm just wasting time and perhaps insulting your intelligence.
If you don't know how to do it but are willing to try, you can probably figure it out yourself, and it's a good learning experience.
With that said, if you get stuck, just ask! I don't mind writing it, if need be.
I am sorry Dan. I am lost. I had other work to do and am now coming back to this macro.
What is the input for the macro. I am trying to determine where / how to start the macro going.
thanks very much
My suggested macro assumes youâre in whatever editor you use for writing markdown files. So the macro selects all the text in the editor, does the search-and-replace, then pastes the result back into the editor.
If I understand the macro correctly, @DanThomas has set the variable PlainText to your example text. Of, course, in real live you want to use the actual text, not the example text. (See Danâs comment in the macro: âThe only thing that's relevant is the "Search and Replace action, which I've colored Magenta.â)
So, you have at least two basic possibilities to get your actual text âintoâ the PlainText variable:
Use a âSet Variable PlainText to Clipboardâ action. (And copy your text to the clipboard before running the macro.)
Use a âRead File toâŚVariable PlainTextâ action, where the file to read is your exported text file.
thank you Tom.
My mistake was thinking that by changing the token to current clipboard, the content in the box would automatically change to %CurrentClipboard%, whereas in appends %CurrentClipboard% to whatever was already is in the box.
thanks again very much. You are very patient.