Re: Count of specific string in Word (was re: Count of Tab characters)
Re: Count of specific string in Word (was re: Count of Tab characters)
- Subject: Re: Count of specific string in Word (was re: Count of Tab characters)
- From: Emmanuel <email@hidden>
- Date: Tue, 13 Feb 2001 08:10:14 +0100
At 5:20 +0100 13/02/01, Bill Planey wrote:
>
tell MS Word
>
for any paragraph which contains string "zwx"
>
delete entire paragraph
>
end tell
>
>
or:
>
>
tell MS Word
>
set count of paragraphs which contain string "zwx" to ParaCount
>
repeat ParaCount times
>
find string "zwx"
>
extend selection to entire paragraph
>
delete selection
>
end repeat
>
end tell
Just in case Word eventually can't do it, Smile can:
-------------------------- tested
tell application "Smile"
set every paragraph of window 1 where it contains "zwx" to ""
end tell
--------------------------
and
-------------------------- tested
tell application "Smile"
item 1 of (replace "zwx" with "zwx" in (get text of window 2))
end
--------------------------
(returns the number of occurrences of "zwx")
Emmanuel