Re: Count of Tab characters
Re: Count of Tab characters
- Subject: Re: Count of Tab characters
- From: g3pb <email@hidden>
- Date: Mon, 22 Jan 2001 20:05:55 -0900
-- mixing in a little MacPerl will help the speed
tell application "Microsoft Word"
activate
do Visual Basic " Selection.WholeStory"
copy
end tell
set wordText to the clipboard
tell application "MacPerl"
Do Script ["
$count = ($ARGV[0] =~ tr/ //);
MacPerl::Reply($count);
", wordText]
end tell
set countTabs to result
-- hcir
mailto:email@hidden
>
This proves surprisingly slow, 25 seconds to do a 48 page/944 tabs document
>
OMM, including trying to speed things up by turning screen updating off.
>
>
tell application "Microsoft Word"
>
do Visual Basic "Application.ScreenUpdating = False
>
theNumber = 0
>
With Selection.Find
>
.Text =\"^t\"
>
.Wrap = wdFindStop
>
Do While .Execute = True
>
theNumber = theNumber + 1
>
Loop
>
End With
>
Application.ScreenUpdating = True
>
MsgBox theNumber & \" tabs in this document\""
>
end tell