Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: How to write data at the end of doc in reverse order?[CS6-jsx]

$
0
0

not sure i understand what you are trying to achieve, but i am quite sure you are overcomplicating things. From your code in guess you are trying to do some kind of endnote system? if so, here is a bit of pseudocode it might help you:

 

//set grep find options as desired
var myFound =myStory.findGrep();
var l=myFound.length;while (l--) //simple iterate backwards trick{// add the numbering, without changing anything else:
myFound[l].insertionPoints[0].position=Position.SUPERSCRIPT;
myFound[l].insertionPoints[0].contents=l+1; // javascript does the automatic conversion, so String(l+1) is redundant, but nice}// get the last insertion point of the story: 
var myLastIP=myStory.insertionPoints[-1];//search  again
var myFound =myStory.findGrep();
var l=myFound.length;while (l--) {//move the found stuff AFTER the last insertion point
myFound[l].move(LocationOptions.AFTER,myLastIP);}

 

a side note: my "pseudocode" looks suspicious like javascript, however i did not test it, provide no guarantees, take no responsability whatsoever about it.


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>