Dear friends,
Yet now I can not reproduce the following situation in a short test script:
- A document is opened and the script looks for existence of a Reference page "FM-calc"
- If found, skip to step 4
- If not found, such a reference page is copied from a template
- Work on the reference page: replace some paragraphs.
- The user does no see that the script has worked on the ref page and invokes a dialoge
- This dialog inserts a marker at the current location
- The marker is inserted in the reference page where the work has been left
How to go back to the current body page (which is the first one)?
Just placing
var pgf = goCurrentDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
prior to the insertion of the marker does not do the trick.
Normally the user woud place the cursor into the document at a specific location and then invoke the dialog: this works fine.
But this dialog stays open when the user changes the document.
In the new document there may be no reference page and hence the script creates one.
The user click outside the text frame (illegal location for marker insert) - This can be handled with
if (!goCurrentDoc.TextSelection.beg.obj.ObjectValid()) { alert ("Please place cursor in document text flow or select something!"); return; }
But the for the switching back from the work on the ref page I have not found a solution.