Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call method "checkSpelling:" question



Hi all,

Answering my own question here, maybe it will help somebody sometime.

for automatic spell checking a string there is the need to load the "NSSpellChecker" first:
set mySpellChecker to call method "sharedSpellChecker" of class "NSSpellChecker"
this will select the spell checker for the current selected language of the app.
Then you can use:
set foundRange to call method "checkSpellingOfString:startingAt:" of mySpellChecker with parameters {theString, 0}
This starts a search at 0, the beginning of the string, and returns a number pair for the first found error or nil of there is no error.
I haven't found a way to directly interpret nil in ASS but the result of the above can be used as below:
if ((item 1 of foundRange) = (item 2 of foundRange)) then
call method "setSelectedRange:" of (text view 1 of scroll view 1 of window of theObject) with parameter {0, 0}
else
beep
call method "checkSpelling:" of (text view 1 of scroll view 1 of window of theObject)
call method "showGuessPanel:" of (text view 1 of scroll view 1 of window of theObject)
end if

Regards
Andreas


Hi all,

I have an ASS app, which goes thru a list of text and loads the text into a text view, to do some spell checking.
I can use the standard menu to do spell checking, which is not really what I want to do, since the lists contains several hundred of entries and it's annoying enough to press a button to go to next entry.
So I thought it could be a good idea to use the method "checkSpelling:" which finally works, so any new text string is checked and the first found error is displayed - if there is any. If not I got a beep like with an error, which is also annoying. Unfortunately the menu behaves the same, so it's somehow a good solution, but ...
Has anybody an idea how to get rid of this beep? I tried to put it into a try block, but since it's not an error this doesn't help.

Any ideas are appreciated.

Best regards
Andreas


Andreas Kiel

Spherico
Nelkenstr. 25
D-76185 Karlsruhe
Tel.: +49 (0)721 183 9753
eFax: +1 650 897 8094
eMail: email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Call method "checkSpelling:" question (From: Kiel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.