How to find n replace multiple characters in multiple docume

I am trying to find and replace multiple characters in multiple documents, and looking to see how this is done in devonthink?

The characters I am trying to replace are sets latin diacritics from one font formating style to another.

Currently I can replace on character at a time with the find and replace option.

Is there a way to script devonthink to replace multiple characters?
and can you make this happen across multiple documents?


Here’s super-simple example to replace words in the frontmost text document:

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

Is the same result in the frontmost text document: not achieved by using the edit/ find/ menu ( command F) and use the replace all option.

This is how I have been doing the task such as
find- å
replace -ā

and I get my latin diacritics that will render on the web. but it is very time consuming and I would like to make the computer do the hard work for me.

My question is how do I do this in multiple documents.

Can it devonthink be scripted to go through the whole database or a specific folder in the database.

say 200 text files in a folder

and change multiple characters in those documents.

such as

å to ā
Ä to Ā
à to ḍ
â to Ḍ

etc etc

I have been experimenting with a tool called mass replace it that has a find and replace screen option that alows multiple queries

To have this type of option in devonthink would be great so you could change the spelling of a series word through out a database, Which is exactly what i’m looking for.

I have been discussing with the developer
and found out another glitch is that the files are RFT created from devonthink

Their reply is as follows

Finding & Replacing words should be possible (see example above) but characters… I don’t know… maybe using GUI scripting/system events.

I could discuss some of the search and replace scripts I have that use Ruby’s regular expression capabilties, but in the interests of simplicity, you might want to try Barebones TextWrangler:
It supports multi-file search which would address your needs in a relatively interactive user interaction.

It doesn’t do RTF, but you could search on the character escapes and replace accordingly.

Another choice would be Text-Edit Plus:
Which will open RTF and is eminently Applescriptable. Downside is that it doesn’t do RTF Unicode escapes, which I saw that your post contained:

such as\
\'e5 to \uc0\u257 \
\'c4 to \uc0\u256 \
\'e0 to \uc0\u7693 \
\'e2 to \uc0\u7692 \
etc etc\

HTH, Charles

I took some time for me to get back on this one but I found a solution to my problem so it may be of use for others to know about it.

a app called Jedit X

It does the multiple find and replace for RFT and also does multi documents. It also has some other features that are good for cleaning files of characters ect.
It is designed for writing code like BBedit and Textmate, but both those app did not work for this task here.

As a work flow it was very easy to export the file out of devonthink, process it through jedit x in a flash and import it straight back into the archive.

A cool feature is that you can export the find and replace set out of Jedit X as txt files and adjust them and import the back in.

This made it easy for me to have different set to work with.


My final note on this thread is the happy discovery that with jedit X you can drag a file out of devonthink - not export- into jedit X use it’s text processing tools not available in devonthink and save the changes directly in your devonthink archive/database. :laughing:

Yes, and the equivalent command to open and edit a document under an external application is the contextual menu option ‘Open With’. Also, the menu command, Data > Open With.

Is there any update to the above question?
Namely I would like to search and replace a character (or a word) across my multiple RTF files within DTPO app.

No. The only possibility is to use either a script or a third-party app.