• 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: Nice Automator article on O'Reilly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nice Automator article on O'Reilly


  • Subject: Re: Nice Automator article on O'Reilly
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 6 May 2005 23:47:49 -0700

On May 6, 2005, at 2:07 PM, David Marshall wrote:
I greatly admire the syntactical efficiency of C, for example. Years ago I was able to write an absurd little command-line program that took as input an English word and returned its Pig Latin equivalent. (Try THAT in AppleScript!)


I've done that; here's a minor modification of the code I posted on May 21 two years ago:

set originalText to "Now is the time for all good men to come to the aid of their parties."
set tempResult to {}
set vowels to {"a", "e", "i", "o", "u"}
set translationList to the words of the originalText


repeat with thisWord in translationList
if the first character of thisWord is in the vowels then
set tempResult to tempResult & (thisWord & "yay" as text) as list
else
if (character 1 of thisWord is in {"t", "c", "s"} and character 2 of thisWord is "h") then
set n to 2
else
set n to 1
end if
set thisWord to (text (n + 1) thru -1 of thisWord) & (text 1 thru n of thisWord) & "ay" as text
set tempResult to tempResult & thisWord as list
end if
end repeat
set {TID, text item delimiters} to {text item delimiters, space}
set the resultingText to tempResult as text
set text item delimiters to TID
resultingText



-->
"owNay isyay ethay imetay orfay allyay oodgay enmay otay omecay otay ethay aidyay ofyay eirthay artiespay"


--------------------------------------------------------
      Misquotation of unattributed, trite
        metaphysical saying goes here.

  Stupid ascii               Unnecessary notice of
graphic goes here.        responsibility goes here.
---------------------------------------------------------

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Nice Automator article on O'Reilly (From: David Marshall <email@hidden>)

  • Prev by Date: Re: new todo in iCal
  • Next by Date: Re: Script as internet helper protocol in tiger
  • Previous by thread: Re: Nice Automator article on O'Reilly
  • Next by thread: Re: Nice Automator article on O'Reilly
  • Index(es):
    • Date
    • Thread