Re: Intro and Can this be done
Re: Intro and Can this be done
- Subject: Re: Intro and Can this be done
- From: Ken Dobson <email@hidden>
- Date: Fri, 02 Feb 2001 07:07:51 -0500
Christopher Stone wrote:
>
A quick look at the dictionary yields this sort of mess:
>
>
(Major wrappage)
>
>
tell application "AppleWorks"
>
if exists of document 1 then
>
tell document 1
>
set cntr to count of words
>
>
if (get on styles of (style of word 1)) contains italic then
>
>
set style of word 1 to {class:text style info, on styles:{bold}, off
>
styles:{italic, underline, outline, shadow, condense, extend, strikethru,
>
superscript, subscript, superior, inferior, double underline}}
>
>
end if
>
end tell
>
end if
>
end tell
>
>
I'd think it would be possible to tell every word whose style record contained
>
an on-style of bold to set it's attributes to whatever is desired, but I've
>
not found a method of doing so.
>
>
>
Best Regards,
>
>
Christopher Stone
Perhaps I need to take another look at the AppleWorks script. The line I was
omitting was "Tell document 1" ( although I only had one document open and
was using "words of window 1") Otherwise the whole onstyles / offstyles
jumble looks similar, I was trying to wrestle the same commands in my test
document. It became easier to boil italic / bold down to true or false in
Word. I would think one would be able to switch the style flags on and off
in any scriptable WP app using similar syntax to the MS Word script in my
previous post.
I'm still using AppleWorks 5 which shipped with this Mac, would this be
easier in 6?
--
>
tell application "Microsoft Word"
>
activate
>
repeat with i from 1 to count of words of window 1
>
if word i is italic then
>
set italic of word i to false
>
set bold of word i to true
>
set color of word i to red
>
set highlight of word i to yellow
>
end if
>
end repeat
>
save window 1
>
end tell