delete images within rtfd

if an html-page containing images is converted to rtf, the images are preserved and an rtfd is created instead an rtf. this is very fine in most cases.

but, is there an easy way of forcing devonthink to create an rtf without images instead? I haven’t found any hint on that with the “convert” command.

or as a workaround: is it able to delete all images which are placed within a rtf-file at once?

best regards and thanks for your help.

In Safari, take a look at your Scripts menu. Try this one: “Add text to DEVONthink”. It’s not necessary to select the text. Just click in the page background and select the script. A plain text document is saved in DT Pro that’s text-only. Want to make it rich text? While viewing the new document, select Format > Make rich text (Shift-Command-T).

Changing a rich text RTFD document with images to plain text will remove all the images.

This can be done using Data > Convert…

Easier: Open your RTFD document and click in it. Press Shift-Command-T to convert it to plain text.

Want to convert it back from plain text to RTF? Press Shift-Command-T again. Now it will be rich text, but without images.

thanks for your fast reply. but sadly your suggestions are not a solution for my problem because the nature of plain text is that bold, italic etc. are not preserved which I want to. this the reason I choose rtf instead of plain text.

but I can’t imagine that there is no way to manage this problem with scripting.

Any simple scripting approach would produce the same results. I’ll leave to the scripting experts the possibility that a script could examine the RTFD code for insertion of images and delete only the images.

Of course, you could always do what I do when I’m viewing an RTFD document that contains an image I don’t want to keep. Just select and delete it. :slight_smile:

Most of the captures I make from Web pages are in RTF or RTFD, with only the text and images that I want selected. Many Web designers make this easy, as in the example of Science Magazine online, where one can select the text and images of an article without selecting other unwanted material. Other sites, such as the New York Times, allow one to select a “Print” version.

Here’s some code removing the attachments (images) from the rich text visible in the frontmost window:


tell application "DEVONthink Pro"
	tell text of think window 1
		repeat with theAttribute in attribute runs
			if exists text attachment of theAttribute then set text of theAttribute to " "
		end repeat
	end tell
end tell

thanks christian, that’s very fine.

could you eventually also tell me how I can make find and replace action within rtf-texts with scripts? I’m not able to find commands for that in the functions of devonthink pro.

Here’s an example (but this replaces only whole words):


tell application "DEVONthink Pro"
	set findString to "Test"
	set replacementString to "Success"
	tell text of think window 1
		set every word where it is findString to replacementString
	end tell
end tell

thank you. sorry, but this script does not work.

and one more question: how could I use the delete-images-script for multiple files at once?

It’s at least working over here - which version of OS X do you use and which strings did you use?

I’m using DT 1.1.2 beta on Mac OS X 10.4.6.

I tested it with the search string “taz” and the replace string “Test”

this script does not work in list-view.

Just created a test document containing several instances of “taz” and additional other words and it’s still working. Maybe the case is different as the script is case sensitive, e.g. “TAZ” won’t be replaced?

case-sensitive writing does not solve the problem.

I send you an example file by mail.

Thanks for the file but this seems to be scripting bug of Cocoa/Mac OS X, e.g. it doesn’t work in TextEdit either.