To run a script, open the Configuration dialog and go to the Scripts tab. A list of available scripts will be displayed in the list box on the left side. When a script name is selected by clicking on it, details about that script will be shown in the panel on the right side.
To run the selected script, click the run script button (looks like a play button found on a CD or DVD player).
@echo off
rem copy /y %1 "%programfiles%\Stellarium\scripts" > nul
copy /y %1 "%appdata%\Stellarium\scripts" > nul
pushd "%programfiles%\Stellarium"
start "" stellarium --startup-script=%1 --full-screen=no
popd
rem del "%programfiles%\Stellarium\scripts\%1"
rem del "%appdata%\Stellarium\scripts\%1"
if [ ! -e "$1" ]; then
echo "specify script to be run"
exit -1
fi
if [ ! -d ~/.stellarium/scripts ]; then
echo "~/.stellarium/scripts does not exist"
exit -1
fi
cp $1 ~/.stellarium/scripts
stellarium --startup-script=$(basename $1)
The script language comes with an include() statement that allows to reference functions in other script files.
The name of included script file must be enclosed in double-quotes, not single quotes! Otherwise, the ReferenceError Can't find variable: include is thrown.
include("foo.inc"); // ok
include('bar.inc'); // NOT ok
try catch
The script language is ECMAScript, so try … catch constructs are possible: