Copy link to clipboard
Copied
I need to write such a script, but I do not know how to start to get a list of all the misspelled words in the document, and how to refer to them. Any ideas are welcome. Thank you in advance for any suggestions.
As Brian mentioned, misspelled words aren't exposed to to scripting. But there's a way to get misspelled words using a rather terrible hack. This is a variant of something I found in this forum a couple of years ago. The script creates a list of misspelled words in a new document.
How you relate the words in that list to their text locations is a different matter, you need to script a panel for that with the typos in a list, and each item pointing to a list, or create hyperlinks.
Anyway, this ex
...Copy link to clipboard
Copied
Misspelled words aren't exposed in the DOM, unfortunately. But there are some commercial solutions available that might help. Check out http://mindsteam.com/
Copy link to clipboard
Copied
As Brian mentioned, misspelled words aren't exposed to to scripting. But there's a way to get misspelled words using a rather terrible hack. This is a variant of something I found in this forum a couple of years ago. The script creates a list of misspelled words in a new document.
How you relate the words in that list to their text locations is a different matter, you need to script a panel for that with the typos in a list, and each item pointing to a list, or create hyperlinks.
Anyway, this example shows you how to go about it and can get you started on something bigger.
// Set your spelling properties here
app.spellPreferences.properties = {
checkCapitalizedSentences: false,
checkCapitalizedWords: false,
checkRepeatedWords: false,
checkMisspelledWords: true
}
menu = app.menuActions.item ('$ID/Check Spelling...');
typos = [];
menu.invoke();
if (!app.selection.length) { // No spelling errors
exit();
}
typos.push (app.selection[0].contents);
i = app.selection[0].index;
menu.invoke();
while (app.selection[0].index !== i) {
typos.push (app.selection[0].contents);
i = app.selection[0].index;
menu.invoke();
}
var story = app.documents.add().textFrames.add({
geometricBounds: app.documents[0].pages[0].bounds,
contents: typos.join('\r'),
});
Copy link to clipboard
Copied
Thank you so much for your help. I think I will do something about it.
Having a list I can search the document and mark all those words.
Copy link to clipboard
Copied
Dear Peter,
This is working fine as I expected, but how to disable spell check dialog after generated misspelled word list?
Sumit
Copy link to clipboard
Copied
I've no idea. . .
Copy link to clipboard
Copied
Thank you for your response.
Sumit