11 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
source | link

As KubaKuba notices in the commentcomment, undocumented FrontEnd`ExportPacketFrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explainedexplained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> FalseDynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = Insert[nb, DynamicUpdating -> False, 2];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Insert[nb,DynamicUpdating->False,2];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = Insert[nb, DynamicUpdating -> False, 2];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Insert[nb,DynamicUpdating->False,2];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = Insert[nb, DynamicUpdating -> False, 2];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Insert[nb,DynamicUpdating->False,2];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

10 deleted 162 characters in body
source | link

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = 
  Notebook[First@nb, 
   Append[FilterRules[List @@ Rest[nb], Except[DynamicUpdating]]Insert[nb, 
    DynamicUpdating -> False]];False, 2];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Notebook[First@nb,Append[FilterRules[List@@Rest[nb],Except[DynamicUpdating]]nbDynamicOff=Insert[nb,DynamicUpdating->False]];>False,2];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = 
  Notebook[First@nb, 
   Append[FilterRules[List @@ Rest[nb], Except[DynamicUpdating]], 
    DynamicUpdating -> False]];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Notebook[First@nb,Append[FilterRules[List@@Rest[nb],Except[DynamicUpdating]],DynamicUpdating->False]];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = Insert[nb, DynamicUpdating -> False, 2];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Insert[nb,DynamicUpdating->False,2];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

9 deleted 102 characters in body
source | link

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd (to be on the safe side I also set NotebookDynamicExpression -> Null):

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = 
  Notebook[First@nb, 
   Join[FilterRules[ListAppend[FilterRules[List @@ Rest[nb], 
     Except[DynamicUpdating | NotebookDynamicExpression]]Except[DynamicUpdating]], {DynamicUpdating -> False,
       NotebookDynamicExpressionDynamicUpdating -> Null}]];False]];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Notebook[First@nb,Append[FilterRules[List@@Rest[nb],Except[DynamicUpdating|NotebookDynamicExpression]]Except[DynamicUpdating]],DynamicUpdating->False]];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd (to be on the safe side I also set NotebookDynamicExpression -> Null):

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = 
  Notebook[First@nb, 
   Join[FilterRules[List @@ Rest[nb], 
     Except[DynamicUpdating | NotebookDynamicExpression]], {DynamicUpdating -> False,
       NotebookDynamicExpression -> Null}]];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Notebook[First@nb,Append[FilterRules[List@@Rest[nb],Except[DynamicUpdating|NotebookDynamicExpression]],DynamicUpdating->False]];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

As Kuba notices in the comment, undocumented FrontEnd`ExportPacket allows conversion of a whole Notebook into plain text:

nb = NotebookGet@EvaluationNotebook[];
First[FrontEndExecute[FrontEnd`ExportPacket[nb, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

First[FrontEndExecute[FrontEnd`ExportPacket[nb,\"PlainText\"]]]"

But it isn't the whole story. Surprisingly FrontEnd evaluates and updates the Dynamic objects in the Notebook sent as the first argument of FrontEnd`ExportPacket!

With Mathematica 10.4.1 when trying to convert to plain text the "Views.nb" Documentation Notebook (warning: evaluation of the following code can make Mathematica not responding for several minutes!)

nbWithDynamic = 
  Get@FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
     "System", "Tutorials", "Views.nb"}];

First[FrontEndExecute[FrontEnd`ExportPacket[nbWithDynamic, "PlainText"]]];

I observe that Kernel downloads a lot of data from the Wolfram paclet server obviously in order to update the Dynamic expressions in this Notebook (the most of the data should be due to the second example under the "SlideView" section which downloads shapes for all countries available via CountryData[]).

This behavior is especially strange because no Dynamic objects from that Notebook are displayed on the screen (according to the Documentation, Dynamic is updated only when displayed on the screen). So this is a bug and serious security violation. (UPDATE: As explained by John Fultz, exporting in some fundamental sense is equivalent to displaying and this behavior is by design.)

To prevent this one should set the DynamicUpdating -> False option for a Notebook before sending it to the FrontEnd:

nb = NotebookGet@EvaluationNotebook[];
nbDynamicOff = 
  Notebook[First@nb, 
   Append[FilterRules[List @@ Rest[nb], Except[DynamicUpdating]], 
    DynamicUpdating -> False]];
First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff, "PlainText"]]]
"nb=NotebookGet@EvaluationNotebook[];

nbDynamicOff=Notebook[First@nb,Append[FilterRules[List@@Rest[nb],Except[DynamicUpdating]],DynamicUpdating->False]];

First[FrontEndExecute[FrontEnd`ExportPacket[nbDynamicOff,\"PlainText\"]]]"

Disabling the DynamicUpdating also solves the problem with FrontEnd`ExportPacket sometimes returning just Null (but at the second attempt on the same file it returns the expected result). Of course it also speeds up the conversion several times and solves the problem with the Dynamic updating timeout dialog appearing during the conversion (what stops the process of computation until you press the "Continue waiting" button).

8 added 309 characters in body
source | link
7 added 44 characters in body
source | link
6 deleted 3 characters in body
source | link
5 added 189 characters in body
source | link
4 added 1143 characters in body
source | link
3 added 176 characters in body
source | link
2 added 197 characters in body
source | link
1
source | link