You should avoid menuActions. Why do you not use:
(And by the way. To me this does not seem to be the kind of problem that requires lots of exclamation marks... :-))
thanks Ralf for ur help.
I just used (!) only to get ur attention.
ahakkim wrote: "I just used (!) only to get [yo]ur attention."
Which is exactly what's wrong with it.
I don't know about everyone else, but I am likely to be slower to read/respond to messages with exclamation points, all caps, or marked urgent. There's no need to shout. People will get to the messages when they have time to do so.
How would one go about removing the notes from a document.
In the UI: Notes -> Remove notes from Story.
That suggests it's a story-wide, rather than a document-wide command. Checking the JS help now (please hold...)
Yes, its place in the hierarchy is
XmlStory | Story | TextFrame | InsertionPoint | Text | Character | Word | Line | TextColumn | Paragraph | TextStyleRange Note
So, simply stating
the_story = app.selection.parent;
kills every note in the story containing the text cursor. To positively remove every note from every story, just loop it over the document's stories collection.
[Jongware: odd behaviour of that flashy editor... hopefully corrected]
Thanks for the above info!
would it start with
for( var i =?
? means i have no idea.
As for your question, I hijacked these lines from another discussion, which I can use to explain one of ID's vagueries.
var myStory = app.activeDocument.stories.everyItem().getElements();
for (var j = myStory.length - 1; j >= 0; j--)
The first line gathers a collection of InDesign elements (all stories) and stores them into an array. That array myStory does not contain the 'actual' elements, but rather points to the InDesign elements. The distinction is important, because if you modify something in the document, the array pointer is no longer valid! What happens, is
InDesign: [a b c]
myStory 0 1 2
-- now imagine you delete [a] from InDesign:
InDesign: [b c]
myStory 0 1 2
-- and element #2 points to a digital limbo. The trick is to make the loop loop backwards, starting at (and optionally modifying) the last element, rather than the first.
Thank you so much!