Сделайте все экземпляры определенных строк в файле RTF полужирным
330
Speldosa
Допустим, у меня есть файл RTF со следующим содержанием:
Я люблю собак. Большинство людей любят собак. Некоторым кошкам нравятся собаки.
Теперь я хотел бы сделать каждый случай «собак» жирным. Как я могу добиться этого самым простым способом без внесения всех изменений вручную?
2 ответа на вопрос
3
m4573r
The simplest way it to open your document in text mode (not rtf), and to do a search and replace with those parameters:
search for: dog
replace with: \b dog \b0
Save your document without modifying anything else, and it should be okay. You should make a copy of the original beforehand though, in case something goes wrong.
0
user495470
You could also open the RTF file in TextEdit and then run a script like this in AppleScript Editor:
set x to "dogs" set text item delimiters to x tell application "TextEdit" to tell document 1 set ti to text items of (get its text) repeat with i from 1 to (count of ti) - 1 set l to count of (items 1 thru i of ti as text) set font of characters l thru (s + (length of x)) to "Helvetica Bold" end repeat end tell