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: Case sensitive find/replace
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Re: Case sensitive find/replace
Subject
:
Re: Case sensitive find/replace
From: Marc Myers <
email@hidden
>
Date: Fri, 21 Jul 2006 19:11:21 -0400
AppleScript was designed so that people can use the capabilities of different applications in a single work flow. Why not use it that way?
Grab the text you want to manipulate, paste it into a window of a scriptable text editor, and use the text editor's "replace" command to get what you want.
on run
set theText to "Charles Lamb said,\"Mary had a little lamb, some mashed potatoes, and mint jelly.\""
set srchStrng to "lamb"
set replStrng to "pork"
my CSReplace(theText, srchStrng, replStrng)
end run
on CSReplace(theText, srchStrng, replStrng)
set TEPon to false
tell application "Finder"
if (name of application processes contains "Tex-Edit Plus") then set TEPon to true
end tell
tell application "Tex-Edit Plus"
make new window at beginning
set contents of window 1 to theText
replace contents of window 1 looking for srchStrng ¬
replacing with replStrng ¬
with cases matching
set theText to contents of window 1
close window 1 without saving
if not TEPon then
ignoring application responses
tell application "Tex-Edit Plus" to quit
end ignoring
end if
end tell
return theText
end CSReplace
Result: "Charles Lamb said,\"Mary had a little pork, some mashed potatoes, and mint jelly.\""
_______________________________________________
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
Prev by Date:
Re: Case sensitive find/replace
Next by Date:
Re: Keychain scripting
Previous by thread:
Re: Case sensitive find/replace
Next by thread:
Re: Case sensitive find/replace
Index(es):
Date
Thread