• 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: When to use text VS text item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When to use text VS text item


  • Subject: Re: When to use text VS text item
  • From: "J. Stewart" <email@hidden>
  • Date: Sat, 6 Sep 2008 10:51:50 -0400

On 9/6/08 at 8:30 AM, Shane Stanley <email@hidden> spake thusly:

The archived post gives a better example

That last example didn't work correctly (will teach me not to use old text clippings). This one does.


set foo to "Now is the time for all good men to dress moose on the tundra"

--> Script <--
my SrchRplc(foo, "good men", "hockey moms")

on SrchRplc(theTxt, srchStr, rplcStr)
local theTxt, temp, srchStr, rplcStr

# theTxt = text to be searched
# srchStr = text to be replaced
# rplcStr = text to replace with

if theTxt contains srchStr then
set {tids, my text item delimiters} to {my text item delimiters, srchStr}
set temp to every text item of theTxt
set my text item delimiters to rplcStr
set theTxt to temp as text
set my text item delimiters to tids
end if
return theTxt
end SrchRplc
--> /Script <--


John
--
Any sufficiently advanced technology is indistinguishable from magic.  -Arthur C. Clarke


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: When to use text VS text item (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: When to use text VS text item
  • Next by Date: Re: Dialog command
  • Previous by thread: Re: When to use text VS text item
  • Next by thread: Re: When to use text VS text item
  • Index(es):
    • Date
    • Thread