• 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
Re: Capitilization and OSX dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capitilization and OSX dictionary


  • Subject: Re: Capitilization and OSX dictionary
  • From: Matthew Stuckwisch <email@hidden>
  • Date: Sat, 20 Apr 2002 19:17:24 -0500

on getPhrase(theString)
try
set thePara to some paragraph of theString
set wordCount to count thePara's words
set a to random number from 1 to wordCount
set b to random number from a to wordCount
thePara's text (word a) thru (word b)
on error number -1728 -- trap and retry if thePara contains no words
getPhrase(theString)


First, I just wanted to say that the above is a beautiful and well written
bit of AppleScript. There are not many scripters who take full advantage of
the "text (boundry 1) thru (boundry 2)" syntax. :)

I don't think you realize how much I actually use this in Hangman. ;)

Though, the example above, if I'm reading it correctly, will take, say, the following text file:

One word for you
Three words in there
Everyone loves Hangman

Then choose a random paragraph, say, "Three words in there", and then choose a random starting and ending word, so that the possible results could be:

Three
Three words
Three words in
Three words in there
words
words in
words in there
in
in there
there

Which isn't quite what I wanted. Take a look at the file /usr/share/dict/
web2a to see what kinda of stuff I'm looking at. Anyways, I got in AS using code somewhat similar to y'all's. (see another response on list)


Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa / G}(esperNET / irc.massinova.com)
_______________________________________________
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.

References: 
 >Re: Capitilization and OSX dictionary (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: Log in at 8am?
  • Next by Date: Re: Capitilization and OSX dictionary
  • Previous by thread: Re: Capitilization and OSX dictionary
  • Next by thread: Re: Capitilization and OSX dictionary
  • Index(es):
    • Date
    • Thread