Re: help needed getting 2nd last line of text
Re: help needed getting 2nd last line of text
- Subject: Re: help needed getting 2nd last line of text
- From: Shane Stanley <email@hidden>
- Date: Sun, 16 Dec 2012 13:54:15 +1100
On 16/12/2012, at 12:54 PM, Brian Christmas <email@hidden> wrote:
> I error trapped the routine, and get the following error
An "unrecognized selector" error generally means one of two things: you've mis-spelled the method, or you have tried to use a method that belongs to some other class. The latter applies here.
Your problem is that textStorage holds an object that is of a subclass of NSMutableAttributedString, but replaceOccurrencesOfString_withString_options_range_ is a method for NSMutableString. Strings and attributed strings are unrelated classes.
So you can use a string instead of textStorage, say textView's |string|(), and make a mutable string from it. Or you can just coerce to an AppleScript string, and get the count of paragraphs. But I wonder if the variable name theRange means you're after something else entirely, which might explain the puzzling reference to a backwards search.
If what you're after is actually the offset or location of the returns, you're going about it the wrong way...
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
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