Thanks to this great topic, I've found the FrontEndToken that I was looking for: "DeleteGeneratedCells" (well, it is also written in Help but I've found it later :)

Question: I would love to execute it in NotebookObject without confirmation through the automatically displayed ChoiceDialog["Do You really want to..."].

Is it maybe a case of FrontEndTokenExecute parameters?

I suspect I can deal with it by setting some global options for Mathematica but I would rather leave them.

  • 1
    $\begingroup$ Related, perhaps duplicate: How to automate a FrontEnd return? $\endgroup$ – István Zachar Sep 12 '13 at 11:52
  • $\begingroup$ @IstvánZachar I would say it is very closely related because our purposes are a bit little different and acceptable solutions too. But we will see what community decides ;) $\endgroup$ – Kuba Sep 12 '13 at 11:55

Maybe you are looking for something like this. Make a list of the generated cells like this:

cells = Cells[GeneratedCell -> True];

Then delete them from the notebook using this

  • $\begingroup$ I had to check but it seems that for my needs this works well. And there is no ChoiceDialog[] so thank You for this answer :) $\endgroup$ – Kuba May 21 '13 at 18:16
  • $\begingroup$ @Kuba no problem, glad you like it :) $\endgroup$ – Jacob Akkerboom May 21 '13 at 18:17
  • 3
    $\begingroup$ I'm very happy to see answers using the under-utilized Cells function. But I'm not sure what you mean by your statement that this "doesn't use the front end". Both Cells and NotebookDelete require a front end to work properly, and they're implemented by causing the kernel to issue commands to the front end. Incidentally, code very similar to this is in the Applications Examples section of the Cells documentation. $\endgroup$ – John Fultz Sep 12 '13 at 5:48
  • $\begingroup$ @JohnFultz ah, yes, I have made this mistake in another Q&A as well, and fortunately there I was immediately corrected. I should have remembered this Q&A. Thank you $\endgroup$ – Jacob Akkerboom Sep 12 '13 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.