Skip to main content
deleted 1 characters in body; added 1 characters in body
Source Link
user21
user21

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];
Print[$InputFileName];

you will see that boththe Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example, use $InputFileName and derive the information from that instead.

The last print will have the file name. Note that this is not an interactive session; then $InputFileName is ""

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];
Print[$InputFileName];

you will see that both Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use $InputFileName and derive the information from that instead.

The last print will have the file name. Note that this is not an interactive session; then $InputFileName is ""

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];
Print[$InputFileName];

you will see that the Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example, use $InputFileName and derive the information from that instead.

The last print will have the file name. Note that this is not an interactive session; then $InputFileName is ""

added 125 characters in body
Source Link
user21
user21

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];Print[$parameterfile];
Print[$InputFileName];

you will see that both Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use $InputFileName and derive the information from that instead.

The last print will have the file name. Note that this is not an interactive session; then $InputFileName is ""

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];

you will see that both Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use $InputFileName and derive the information from that instead.

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];
Print[$InputFileName];

you will see that both Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use $InputFileName and derive the information from that instead.

The last print will have the file name. Note that this is not an interactive session; then $InputFileName is ""

Source Link
user21
user21

If you look at this

#!/usr/local/bin/math8.0.4/MathematicaScript -script

$HistoryLength=0;
$pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}];
$pwf = "test";
$parameterfile=StringJoin[$pwf,".dat"];
Print[$pwf];
Print[$parameterfile];

you will see that both Print statements work just fine - What requires the FrontEnd are the Notebook*XY*[] functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use $InputFileName and derive the information from that instead.