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

Words collection is empty in Story with ONLY Tables in separate Paragraphs...

Community Expert ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Looks like a bug to me?

 

Words collection for a Story - or Paragraph - that has ONLY Tables - is empty...

 

RobertatIDTasker_0-1722779575753.png

 

RobertatIDTasker_1-1722779589217.png

 

RobertatIDTasker_2-1722779646214.png

 

RobertatIDTasker_3-1722779658946.png

 

RobertatIDTasker_4-1722779904826.png

 

TOPICS
Bug , Scripting

Views

168

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Well, depends on how you look at it. From InDesign's perspective it's consistent. A table sits in a placeholder that's dubbed Character, but it's not a character in the sense of a glyph. When you (grep) search . (any character( you won't find anything.

 

The same goes for embedded frames, you get the same results.

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

But "it occupies some space" in the collection of characters? And even one letter words are 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
Community Expert ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Conceptually a word is not a "building block" in the same way that character is. If I was writing a word-parser I probably would opt to to treat non-glyph characters as word boundary markers, ie. not part of a word. So my parser would return zero too. 
- Mark

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Hi @Robert at ID-Tasker , Look at table properties—there is the storyOffset, which is the insertionPoint I think @Peter Kahrel  is referring to.

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Table.html

 

 

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

@rob day

 

Yes, I know. 

 

But you can't use StoryOffset to get a reference of the Table - even when documentation says that InsertionPoint has a Tables collection - it return "0": (*)

RobertatIDTasker_0-1722808487586.png

 

So you would need to get Index of the InsertionPoint then get a reference to the Character in the same Story - then you can get the Table.

 

And myTable.parent returns TextFrame... which is crazy on its own...

RobertatIDTasker_3-1722809525568.png

 

 

But if you add a letter(s) before and after - then you get a Word:

RobertatIDTasker_1-1722809099760.png

 

 

(*) don't have time to check, but I'm pretty sure, all other collections also will be empty - someone just based InsertionPoint on the Text:

RobertatIDTasker_2-1722809376639.png

 

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 ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

But that's nothing - I've just finished adding some math functions:

 

RobertatIDTasker_0-1722809851237.jpeg

 

So now it's possible to reformat values - in tables or in text - and then re-calculate and update totals.

 

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 ,
Aug 05, 2024 Aug 05, 2024

Copy link to clipboard

Copied

Words collection for a Story - or Paragraph - that has ONLY Tables - is empty...

 

The word collection for a story with multiple returns or white spaces also empty.

 

Screen Shot 11.png

 

var i = app.activeDocument.stories.everyItem().insertionPoints.everyItem().getElements();
$.writeln(i.length)
//returns 15

var w = app.activeDocument.stories.everyItem().words.everyItem().getElements();
$.writeln(w.length)
//returns 0

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 ,
Aug 05, 2024 Aug 05, 2024

Copy link to clipboard

Copied

LATEST

@rob day

 

Yes, words are build from letters, so empty paragraph or space won't return 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