• 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: Finding a location in a text file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding a location in a text file


  • Subject: Re: Finding a location in a text file
  • From: kai <email@hidden>
  • Date: Sat, 19 Nov 2005 17:01:30 +0000


On 19 Nov 2005, at 16:21, Michelle Steiner wrote:

On Nov 19, 2005, at 7:25 AM, kai wrote:

tell application "Tex-Edit Plus" to tell front document to if search looking for "want" then delete (text 1 thru character (character before selection's offset))

You can use "then" to mean "next action"? It's not reserved strictly for "if-then" constructs?

On reflection, it may seem as though that's the case at first glance, Michelle. However, even in this case, the "then" is actually part of an "if-then" construct.


My apologies for any confusion caused by the rather lengthy line. Here's what the code might look like in a more regular, step-by-step construct:

--------------------------------

tell application "Tex-Edit Plus"
	tell front document
		search looking for "want"
		if result is true then
			set | selection offset | to offset of selection
			set | last delete position | to | selection offset | - 1
			delete (text 1 thru character | last delete position |)
		end if
	end tell
end tell

--------------------------------

---
kai


_______________________________________________ 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: 
 >Finding a location in a text file (From: Jim Brandt <email@hidden>)
 >Re: Finding a location in a text file (From: kai <email@hidden>)
 >Re: Finding a location in a text file (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Producing Unicode-only characters
  • Next by Date: Fwd: for geeky women
  • Previous by thread: Re: Finding a location in a text file
  • Next by thread: Re: Finding a location in a text file
  • Index(es):
    • Date
    • Thread