I am facing a matter that I can't find a way out.
To be brief, I am trying to store app.selection.contents (some text) & get access to that value even after the text is deselected.
In case I am wrong (May be :-S), let me detail the process of my script:
1. A user selects some text
2. The user launches the script
3. The script picks the contents of the selection
var myOriginalContents = sel.contents;
4. ...makes a index reference & topic
5. ...generates the index on last page
6. ...find original contents in the index text frame
7. ..selects found text
8. ...adds a hyperlink (source = text; destination = original selection page, name = myOriginalContents).
Just assign the selection to a var.
you have it in:
var myOriginalContents = sel.contents
so unless you change the contents of those vars (deleting the elements) you can always get it by using myOriginalContent, no need to select it again.