Re: Count of Tab characters
Re: Count of Tab characters
- Subject: Re: Count of Tab characters
- From: David Wignall <email@hidden>
- Date: Wed, 24 Jan 2001 16:57:51 +1300
on 24/1/01 5:09 AM, Bill Planey at email@hidden wrote:
>
Where does one get MacPerl, and what is it?
>
>
> -- 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
<quote>
Perl is a high-level programming language with an eclectic heritage written
by Larry Wall and a cast of thousands. It derives from the ubiquitous C
programming language and to a lesser extent from sed, awk, the Unix shell,
and at least a dozen other tools and languages.
<unquote>
The MacPerl Pages <
http://www.ptf.com/macperl/> is probably as good a place
as any to start. How you react to Perl probably depends on what you already
know; it's completely opaque to me.
Now, as it happens I couldn't get the above script to work. Running from
Smile it gave me error -619 with "the clipboard" in line 6 highlighted.
Thinking it was because Word maintains it's own clipboard, I threw in a
Finder activate to force Word to export said clipboard. The result I then
got was 0. I can test up to the Perl script but that bit leaves me dead in
the water...
dqw