• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Accessing Dictionary Contents (was: Re: AppleScript Try)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing Dictionary Contents (was: Re: AppleScript Try)


  • Subject: Accessing Dictionary Contents (was: Re: AppleScript Try)
  • From: John McAdams <email@hidden>
  • Date: Thu, 29 Aug 2002 10:35:10 -0400

I dug out the script that I used for this and found - to my dismay - that it
had broken since I installed 10.2.

I was looking at the script and noticed that there were still characters where the tabs had been, even after you removed the tabs. Following the discussion on Unicode text I tried Arthur Knapp's routine to convert the text to plain text. The 10.1 version of your script worked fine. Oddly enough, since I'm running 10.2, I had trouble with the 10.2 version (errors at the end with menu items). Here's the 10.1 version with the plain text conversion routine:

tell application "AppleWorks 6" to set theText to text of document 1
set AppleScript's text item delimiters to tab
set theText to every text item of theText
set AppleScript's text item delimiters to ""
set theText to AsText(theText)
tell application "AppleWorks 6"
activate
set text of document 1 to theText as string
set thePara to index of last paragraph of document 1
repeat until thePara is 1
set endTopic to thePara
repeat until size of character 1 of paragraph thePara of document 1 is 18
set endPara to thePara
set currentPara to endPara
repeat until on styles of style of character 1 of paragraph thePara of document 1 contains underline
set thePara to currentPara
set currentPara to currentPara - 1
end repeat
set startPara to index of paragraph after paragraph thePara of document 1
set startTopic to index of paragraph before paragraph thePara 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 (startPara - 1) of document 1
select menu item "collapse" of menu "outline"
else
set thePara to thePara - 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 (startTopic - 1) of document 1
select menu item "collapse" of menu "outline"
else
set thePara to thePara - 1
end if
end repeat
end tell

on AsText(s)--by A. Knapp
try
return (s as record)'s +class ktxt;
end try
return s as string
end AsText
_______________________________________________
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.

  • Follow-Ups:
    • Re: Accessing Dictionary Contents (was: Re: AppleScript Try)
      • From: Mr Tea <email@hidden>
  • Prev by Date: BASH
  • Next by Date: Re: Reading XML files (Philip Aker)
  • Previous by thread: BASH
  • Next by thread: Re: Accessing Dictionary Contents (was: Re: AppleScript Try)
  • Index(es):
    • Date
    • Thread