• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

misspelled words to conditional text

Engaged ,
Nov 16, 2019 Nov 16, 2019

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.

 

TOPICS
Scripting

Views

691

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 19, 2019 Nov 19, 2019

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

...

Votes

Translate

Translate
Community Expert ,
Nov 19, 2019 Nov 19, 2019

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/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 19, 2019 Nov 19, 2019

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'),
});

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 20, 2019 Nov 20, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 17, 2021 Apr 17, 2021

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

-Sumit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

I've no idea. . .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

LATEST

Thank you for your response.

 

Sumit

-Sumit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines