Skip to main content
prema56615405
Inspiring
January 16, 2019
Answered

Remove selected items on active artboard

  • January 16, 2019
  • 3 replies
  • 2387 views

I have written the below javascript for the below actions. Remove command is not working.

1) select the objects on active artboard

2) remove the selected objects

var doc = app.activeDocument;

doc.selectObjectsOnActiveArtboard()

removeAll();

This topic has been closed for replies.
Correct answer prema56615405

The correct answer is as below

var doc = app.activeDocument;

doc.selectObjectsOnActiveArtboard()

app.executeMenuCommand("clear");

3 replies

prema56615405
prema56615405AuthorCorrect answer
Inspiring
January 22, 2019

The correct answer is as below

var doc = app.activeDocument;

doc.selectObjectsOnActiveArtboard()

app.executeMenuCommand("clear");

pixxxelschubser
Community Expert
Community Expert
January 22, 2019

The result is the same as with my answer, right?

rcraighead
Legend
February 14, 2019

I think "clear" would not put content in the clipboard.

Ton Frederiks
Community Expert
Community Expert
January 16, 2019

It would be better to ask this in the scripting forum;

Illustrator Scripting

But if that's all you want to do, recording it as an action would be easy.

Srishti Bali
Legend
January 21, 2019

Discussion moved to Illustrator Scripting

pixxxelschubser
Community Expert
Community Expert
January 21, 2019

The fastest way?

Replace your last line

removeAll();

with

app.executeMenuCommand ('cut');

Have fun

Silkrooster
Legend
January 16, 2019

Not positive but I think the second line requires a ; at the end like the other two lines.