Reply To: Is there a way to separate things like this Automatically?

Home Page / Forums / General InDesign Topics (CLOSED) / Is there a way to separate things like this Automatically? / Reply To: Is there a way to separate things like this Automatically?

#52428
rydesign
Member

I keep getting an error that FindChangeByList is undefined.

is there a certian place I should be putting this… I thought if I inserted it before anything else it would run the find change first and then continue with the rest.

app.doScript (app.activeScript.path/FindChangeByList.applescript);

toMatch = “\d+/\d+R-\d+”;
applyStylename = “LineAbove”;

currentPar = app.selection[0];
if (!(currentPar instanceof InsertionPoint))
{
        alert (“Please place your cursor on the starting line”);
        exit(0);
}

do
{
    do
    {
        currentLine = currentPar.paragraphs[0].contents;
        if (currentLine.match (toMatch))
            break;
        if (currentPar.parentStory.paragraphs.nextItem(currentPar) == null)
        {
            alert (“No match found for “”+toMatch+””!”);
            exit(0);
        }
        currentPar = currentPar.parentStory.paragraphs.nextItem(currentPar);
    } while (1);

    lastMatch = currentLine.match(toMatch);
    do
    {
        do
        {
            if (currentPar.parentStory.paragraphs.nextItem(currentPar) == null)
            {
                alert (“End of text reached”);
                app.select (currentPar.insertionPoints[0]);
                exit(0);
            }
            currentPar = currentPar.parentStory.paragraphs.nextItem(currentPar);
            currentLine = currentPar.paragraphs[0].contents;
            if (currentLine.length < 2) continue;
            testMatch = currentLine.match(toMatch);
            if (!testMatch)
                break;
            if (lastMatch[0] != testMatch[0])
            {
            //    currentPar.underline = true;
                currentPar.appliedParagraphStyle = applyStylename;
                lastMatch = testMatch;
            }
        } while (1);
        if (!testMatch)
            break;
    } while (1);
} while (1);

This article was last modified on April 8, 2010

Comments (0)

Loading comments...