MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to generate report with Mathematica script from command line (no front end)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121269] Re: How to generate report with Mathematica script from command line (no front end)
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Wed, 7 Sep 2011 05:38:04 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Am 06.09.2011 10:05, schrieb james rund:
> Hi,
> first of all: am overwhelmed by the loads of useful tricks on this mailing list!
>
> Now, my current problem is the following, perhaps you can help:
> I want to use Mathematica to make pretty reports of our data analysis.
> I have a mathematica notebook that will load data from a specified file and generate a PDF and CDF accordingly.
> Now I want to turn this into a command line script to do the same job, where the input parameter is the filename of the file that contains the data.
>
> However, the script does not to anything sensible. It does not write the PDF and CDF files.
> I use CreateDocument and NotebookSave for that in the notebook version of the script.
>
> What could be going wrong?
> Do I need to have an open front end all the time?
> if yes ->  how to I load something via a shell command to the front end?
>
> The only solution I came up with so far is pretty bad:
> Have a loop in a front end notebook running ALL THE TIME which checks for a specific file. If the file exists it will generate a report accordingly.
>
> However, this is an embarrassing solution.....don't judge me on that.... ;-))
>
>
> Please tell me a better trick if you know one.

Your problem seems in fact to be that you are using functionality that 
is not provided by the kernel but the frontend, so yes, you need a 
frontend running, but that does not mean you can't set this up to run 
from a script file.

I think what you are looking for is the function UseFrontEnd. It is part 
of the JLink-package. The documentation isn't exhaustive, but most 
probably your problem can be solved by just wrapping UseFrontEnd around 
your code (or parts of it). If you are looking for more details and 
information about how to set this up in a "server" environment where the 
script needs to run in the background you will find that information in 
the documentation for webMathematica.

hth,

albert





  • Prev by Date: Re: Assembling PDFs into a PDF document?
  • Next by Date: Re: Problem loading 3d models
  • Previous by thread: Re: How to generate report with Mathematica script from command line (no front end)
  • Next by thread: f(x)=x: why Plot continues to add new levels of recursion?