Skip to main content
Inspiring
May 23, 2013
Question

how to clear clipboard

  • May 23, 2013
  • 1 reply
  • 11020 views

As the title says, how do i clear the clipboard while scripting with copy/paste functions?

Because i am affraid for crashes because too much items are on the copy buffer

Thanks.

This topic has been closed for replies.

1 reply

CarlosCanto
Community Expert
Community Expert
May 23, 2013

deselect all and copy

app.activeDocument.selection = null;

app.copy();

rcraighead
Legend
July 22, 2019

CarlosCanto​,

Carlos, when I run this snippet from ESTK in AI CC 2015.3 (Mac) AI crashes.

I've tried it on a new, blank document and other documents. Any ideas?

I need to purge the system clipboard.

CarlosCanto
Community Expert
Community Expert
July 22, 2019

hmm, I see that when you don't have anything selected the Copy function is not available in the UI. That might be the issue but it's not making the app crash on Windows and it is clearing the clipboard.

try

app.executeMenuCommand('copy') to see if works

why purge? too much data? or trying to delete "sensitive" data?

can you use keyboard maestro? maybe other apps can copy nothing

is copying something else an option?