Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
Related, perhaps duplicate: How to automate a FrontEnd return? –  István Zachar Sep 12 '13 at 11:52
    
@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 ;) –  Kuba Sep 12 '13 at 11:55
add comment

1 Answer 1

up vote 10 down vote accepted

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

NotebookDelete[cells];
share|improve this answer
    
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 :) –  Kuba May 21 '13 at 18:16
    
@Kuba no problem, glad you like it :) –  Jacob Akkerboom May 21 '13 at 18:17
3  
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. –  John Fultz Sep 12 '13 at 5:48
    
@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 –  Jacob Akkerboom Sep 12 '13 at 10:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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