What JavaScript Function Should Go Here?

The end result of what I'd like is to make a function that will open up a selected powerclip, select all objects inside, turn off any of their outlines, close out of the powerclip, then turn off the outline of the powerclip

I recorded a script to try to do this but I run into an error saying: Layer 'PowerClip Contents"not found Line: 7, Column: 44host.ActiveDocument.Pages.ltem(1).Lay-ers.Item PowerClipContents").Shapes.All).CreateSelection(

It seems to me that the app has not recorded my selection of all objects where I follow Edit>Select All>Objects

I have basic experience with Javascript, does anyone have a line I could use to tell CorelDRAW to select all objects within an edited powerclip thus getting rid of my error prompt? I'd like to know any source material I could use to learn to write JS using CorelDraw's API. Any help with that would be much appreciated. My current script is copied below. I'm using MacOS 14.7, I think that matters in this case. Thanks in advance

// Recorded 10/15/24
//
// Description:
// testing de-outlining powerlips and object wherein
host.ActiveLayer.Shapes.Item(1).Powerclip.EnterEditMode();
host.ActiveDocument.Pages.Item(1).Layers.Item("PowerClip Contents").Shapes.All().CreateSelection();
host.ActiveSelection.Outline.SetNoOutline();
host.ActiveLayer.Shapes.Item(1).Powerclip.LeaveEditMode();
host.ActiveLayer.Shapes.Item(1).Outline.SetNoOutline();

Parents
  • function RemoveOutlines(shape)
    {
        if (shape.Type === 7)
        {
            for (let i = 1; i <= shape.Shapes.Count; i++)
            {
                RemoveOutlines(shape.Shapes.Item(i));
            }
        }
        else
            shape.Outline.SetNoOutline();
    }
    let p = host.ActiveShape;
    let shapes = p.PowerClip.Shapes;
    for (let i = 1; i <= shapes.Count; i++)
        {
            RemoveOutlines(shapes.Item(i));
        }
Reply Children
No Data