I am wanting to run about 15 pages of initialization cells in a CDF, but can't seem to do so. I have set the InitializationCellEvaluation to True and InitializationCellWarning to False, but it doesn't work in the CDF. (works just fine in the .nb) I saw something about the NotebookDynamicExpression, but I wasn't sure how to run a ton of code through it.

Are there any alternatives? I use no Manipulate or Dynamic functions in my code either. For example...

GenerateDisplayShotsFor := 
    Style["GENERATE", Bold, FontFamily -> "Terminal", 20, 
     Background -> LightBlue], 
     DocumentNotebook[DisplayShotsFor, WindowTitle -> "Shots For", 
      WindowFrame -> "ModelessDialog", 
      Background -> RGBColor[48/240, 164/240, 220/240], 
      Editable -> False, TextAlignment -> Center , 
      WindowFloating -> False, 
      WindowMargins -> {{0, Automatic}, {Automatic, 0}}]]]];
  • 1
    $\begingroup$ If I'm not mistaken it is not going to work.You have to put those definitions inside Initialization in DynamicModule or use SaveDefinitions for Manipulate. $\endgroup$
    – Kuba
    Commented Jul 26, 2013 at 18:40

1 Answer 1


It's probably a good idea to look at this question more more information about writing CDF-happy notebooks. In brief, Initialization cells won't function properly in the CDF format. For example if we have the following initialization cell:

a = 1;

And subsequent cell that is not an initialization cell

Manipulate[b + x, {x, 1, 10, 1}]
Manipulate[a + x, {x, 1, 10, 1}, Initialization :> (a = 1;)]

The first Manipulate will not evaluate b when exported in CDF format. All of your initialization needs to go in the Initialization option of Manipulate in this case. As mentioned in the question references above, this seems to be the easiest way to get initialization into a CDF, even if Manipulate is not being used.

  • $\begingroup$ Thank you, but my initialization cells are buttons, graphs, images, and functions being defined that wait for user inputted values. Does Manipulate still work on them? I haven't figured how to wrap them. $\endgroup$
    – user8736
    Commented Jul 26, 2013 at 19:40
  • $\begingroup$ @user8736 You might be asking a bit much out of CDFs. This answer has some insight into managing code for CDFs. $\endgroup$ Commented Jul 26, 2013 at 20:53
  • $\begingroup$ Okay. I understand. Thank you for the link. If you know of another way to deploy a secured (unable to view code etc) notebook feel free to say so. Again, thanks for your help. $\endgroup$
    – user8736
    Commented Jul 26, 2013 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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