Reply To: using indesign menu select all then object pathfinder intersect using script

Home Page / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / using indesign menu select all then object pathfinder intersect using script / Reply To: using indesign menu select all then object pathfinder intersect using script

#85764
Ari Singer
Member

Skemicle, the ‘and’ operator (‘&&’) is an equality operator, not an assignment operator.

This script should work:

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Subtract Paths");
function main() {
    try{
        var mySelection = app.selection;
        var myPicture = mySelection[0];
        var myPath = mySelection[1];
        var topPicture = myPicture.duplicate();
        var half1 = myPath.subtractPath(myPicture);
        var newPath = half1.duplicate();
        var half2 = newPath.subtractPath(topPicture);
        var myGroup = half1.parent.groups.add ([half1, half2]);
        app.select(myGroup);
        } catch(myError) {
            alert("Make sure you selected 2 path items")
            }
        }

This article was last modified on June 14, 2016

Comments (0)

Loading comments...