A script for AppleWorks
A script for AppleWorks
- Subject: A script for AppleWorks
- From: Mr Tea <email@hidden>
- Date: Tue, 30 Apr 2002 00:56:08 +0100
Has anyone else been pasting AS dictionaries into AppleWorks as an
alternative to viewing them in Script Editor? If you don't consider that an
exercise in utter futility, you may find the script appended below useful.
It works it's way through the dictionary, collapsing it into topics and
subtopics for ease of reference.
Before running the script, users may find it beneficial to remove all the
tab characters from the document. I would have included this function in the
script, but the AW dictionary doesn't [seem to] offer a scriptable 'find &
replace' routine, and when I tried removing the tabs by manipulating
AppleScript's text item delimiters I ended up with more tabs than I started
with (see related post: TIDs Tabs & Square Brackets).
Apologies for all the wrapped lines. If anyone has any suggestions on how to
optimise the script and make it less, er, verbose, please speak up.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tell application "AppleWorks 6"
activate
select last paragraph of document 1
repeat until index of paragraph before selection of document 1 is 1
set endTopic to index of paragraph before selection of document 1
repeat until size of character 1 of selection of document 1 is 18
set endPara to index of paragraph before selection of document 1
repeat until on styles of style of character 1 of selection of document 1
contains underline
set thePara to select paragraph before paragraph before selection of
document 1
end repeat
set startPara to index of paragraph after paragraph after selection of
document 1
set startTopic to index of paragraph before paragraph before selection of
document 1
if startPara < endPara then
select paragraphs startPara thru endPara of document 1
select menu item "with subtopics" of menu item "move right" of menu
"outline"
select paragraph before paragraph before selection of document 1
select menu item "collapse" of menu "outline"
else
select paragraph before paragraph before selection of document 1
end if
end repeat
if startTopic < endTopic then
select paragraphs startTopic thru endTopic of document 1
select menu item "with subtopics" of menu item "move right" of menu
"outline"
select paragraph before paragraph before selection of document 1
select menu item "collapse" of menu "outline"
else
select paragraph before paragraph before selection of document 1
end if
end repeat
end tell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.