Skip to main content
Inspiring
November 3, 2015
Answered

[JS]How to get storyUID?

  • November 3, 2015
  • 4 replies
  • 1065 views

Hi.

I can get a graphicFrameUID.   "app.selection[0].id"

But I want to get the storyUID.

Get as a "[app.activeDocument.stories.item(i).id] // [write mode : app.selection[0].parent.id]" but I want the storyUID of the selected textFrame.

Is there any way?

Thanks.

This topic has been closed for replies.
Correct answer Jongware

A TextFrame does not 'own' a story, it's more the other way around. You are probably looking for a textframe's parentStory: app.selection[0].parentStory.id (when the selection is a textframe).

Which, obviously, means that for one continuously threaded story, all of its textframes will have the same story id. Whether or not that is a problem depends on what you need it for.

4 replies

K159Author
Inspiring
November 4, 2015

This panel is SnippetRunner of the SDK sample.

Thanks all.

Legend
November 3, 2015

I often get hold of the story by accessing the lines within the text frame.

...

if ( theLine.parent.constructor.name == "Story" )

...

P.

wckdtall
Inspiring
March 24, 2023

I did not know about constructors, and was about to use idmlComponent name and search in order to determine if a page was a master spread. Thanks for this!

Vamitul
Legend
November 3, 2015

app.selection[0].parentStory.idmlComponentName

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
November 3, 2015

A TextFrame does not 'own' a story, it's more the other way around. You are probably looking for a textframe's parentStory: app.selection[0].parentStory.id (when the selection is a textframe).

Which, obviously, means that for one continuously threaded story, all of its textframes will have the same story id. Whether or not that is a problem depends on what you need it for.

TᴀW
Legend
November 3, 2015

What is that panel? Is that an SDK thing?

Visit www.id-extras.com for powerful InDesign scripts that save hours of work — automation, batch tools, and workflow boosters for serious designers.
Jump_Over
Legend
November 3, 2015

looks like TreeView plug-in...