• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

No Insertion Point or Active Document

Contributor ,
Dec 03, 2022 Dec 03, 2022

Copy link to clipboard

Copied

My find/change script steps through each document in a book as it executes.  At the start of the script, I read each doc filename in the book into an array and then use the SimpleOpen method to make each document active; something I picked from a post a few months ago.  However, I sometimes get an error that says, "No insertion point or active document.  Cannot continue."  Any thoughts on what I might do to fix this?  I searched the forum, but no luck.  Here's the code I'm using to open/activate each doc.

// Open each doc using doc.Name and call executeHitlist function
function searchDocs () {
    for (k = 1; k <= docCount; k++) {
        doc = SimpleOpen(openDocs[k]);
        $.writeln("Searching " + doc.Name + "...");
        doc = app.ActiveDoc;  
        executeHitlist ();
    }
}

 

Views

136

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2023 Jul 24, 2023

Copy link to clipboard

Copied

LATEST

Hi, Fightergator
JavaScript arrays are zero-indexed: the first element of an array is at index 0.

function searchDocs () {
    for (k = 0; k < openDocs.length; k++) {
        doc = SimpleOpen(openDocs[k]);
        $.writeln("Searching " + doc.Name + "...");
        doc = app.ActiveDoc;  
        executeHitlist ();
    }
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines