So… I have several pages from various sources with many links in them which I do not want. Ah ha! I thought! I recall a script in the script menu to the left of ther Help menu. Indeed, there was such a script in the Format group which told me it was designed to remove links. What a blessing, I thought. I shall use this and my life will be improved!
Alas and alack! Imagine my woe when I clicked on the menu item and…nothing happened. I gave it some thought and tried it again, but in various ways. First I highlighted the entire file, then I simply highlighted some links, then one link, then selected the file name. Each time I clicked upon the by now irritatingly supercilious link in the annoying menu, nothing happened. And it did it regularly. That is the one thing I came to rely on… nothing!
I have asked you previously to imagine my woe, now I ask you to further imagine my despair at my inability to make such a seemingly small thing work, if only in some stuttering fashion. I have become saddened and withdrawn from society, a recluse, given to wailing and gnashing of teeth, my hair is unkempt, my clothing in need of repair and I hate to think how I might smell!
I have even (believe this or not at your peril), yes, I have even searched this very forum and yet I am stil without the magical mytical actions I need to undertake in order to run this script, which by now has grown into something like Grendel’s mother in my mind, seeking to destroy me.
If anyone can even point me at a pathway to enlightenment, I would definitely offer some burnt sacrifices or two, depending on the size of bullock I can purchase at the local market (and also whether I can get round existing by-laws about killing and then burning large animals - if not, then a couple of pork chops will have to do).
Yours in despair (and yet, surprisingly, also in hope!)
In what format?
I found this in the Release Notes for DEVONthink 3.9.3:
Added Remove Links and Remove Attachments scripts to Scripts > Format. These scripts are used to easily remove links or attachments from the current rich text file, e.g., from clipping web content as rich text.
@BLUEFROG these two newer scripts are not described in the Manual under Appendix > Scripts. The version history in the current manual only goes back to 3.9.4, so anyone looking for a description in the most recent documentation is out of luck.
I just tested with some RTFs. This script does not work as I had imagined. It removes both the URI and the linked text itself. Maybe this is useful to other people, but I don’t think I would ever want this. If you add a description in the manual, I think it would be good to make this explicit.
I assumed the result would be the same as using the command Format > Remove Link or Format > Edit Link… and choosing “Remove” (also available with right-click). These commands just clears the URI, but leaves the text itself.
@Nig if we are talking about RTF, HTML, Formatted Note, Web Archive or PDF – and a manageable amount of documents – it is pretty quick to do manually:
- For PDFs (and RTF), you can use Tools > Inspectors > Links.
Select all links, right-click and choose “Delete”. - For RTF, HTML, Formatted Note and Web Archive:
- Open the document
- Select all (⌘A)
- Use the Edit Link command and choose “Remove”.
I can’t see any link formatting commands for the built-in markdown editor.
Stop imagining then
I can’t recall the specific use case, but not every document needs links. In fact, many don’t. So if you’re taking data from a source that has links you have no need of, this clears those links. Preserving the text would be specific to certain uses cases, not mandatory. For example, an email converted to rich text could have extraneous links, especially in the footer of commercial emails.
Also, scripts are often examples of how things can be done. In this case, addressing text that belongs to a think window
and how it’s made up of attribute runs
having URL
s. It even shows how you can delete some text by setting it to an empty quote.
Well – that’s why I actually tried it out
I opened it in script editor to see if I could get a sense of how it worked, and that’s also how I read it – it sets text
, not URL
, which confused me a bit.
I just wanted to note the result here, since the name of the script is almost identical to the “Remove Link” command, but the result is notably different.
I can’t recall the specific use case, but not every document needs links.
Sure! And this script might very well be useful to others. I just can’t recall a situation where I want a script to indiscriminately remove all links including the linked text itself.
Also, scripts are often examples of how things can be done.
True. And since this script is so short and simple, I do think it is a good example to learn from
Thanks! That works perfectly! The smell of bacon should be coming your way soon.