• 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
Search & Replace multiple Paragraph returns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Search & Replace multiple Paragraph returns


  • Subject: Search & Replace multiple Paragraph returns
  • From: doug rogers <email@hidden>
  • Date: Wed, 8 Jun 2005 14:12:29 -0400

I have a Search and Replace handler from <http://bbs.applescript.net/viewtopic.php?id=11449> that I should be able to use. I want to replace multiple paragraph returns in a variable with just a single return. To set the value of the search and replace string, I have copied them out of the original text window. The handle returns the same text I load into the variable, and Hog Bay Notebook returns the error that it can't continue SearchReplaceText.

tell application "Hog Bay Notebook"
	set TheNewsItem to note of selected entry of notebook viewer 1
	searchReplaceText("


", " ", TheNewsItem) end tell

to searchReplaceText(searchTerm, replaceTerm, theText)
	set searchTerm to searchTerm as list
	set replaceTerm to replaceTerm as list
	set theText to theText as text

	set oldTID to AppleScript's text item delimiters
	repeat with i from 1 to count searchTerm
		set AppleScript's text item delimiters to searchTerm's item i
		set theText to theText's text items
		set AppleScript's text item delimiters to replaceTerm's item i
		set theText to theText as text
	end repeat
	set AppleScript's text item delimiters to oldTID

	return theText
end searchReplaceText


I also found <http://bbs.applescript.net/viewtopic.php?pid=35449> which does a call to shell, also returning an error... an error dialog quite full of all the text it can't parse :-) and a number of error messages I don't grasp, so I thought I would go back to vanilla above.


But it seems I am trying to do something I don't understand ... again... :-)

Oh! and I did use the poke and try methods outlined in Matt's book to get the stuff out of Hog Bay Notebook.... so I am learning something...


There is a crack in everything. That's how the light gets in. __________<http://home.golden.net/~samu>__________

_______________________________________________
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: Binary math operations (and, or, etc.)
  • Next by Date: Re: OT: Re: Shit - it's all true
  • Previous by thread: Acrobat 6 question ... Reduce File Size...
  • Next by thread: Re: Search & Replace multiple Paragraph returns
  • Index(es):
    • Date
    • Thread