Hi all, i wrote a script to mine some data instead os using and astronomical
anuary, but to finish my project i need to write the data in a file, the thing
is, i can´t find the reference guide to script language. Tried some, and the
ones that are said to be used didn´t had the Math.round function wich i found
god knows how . Anyone knows how to do it? How to write the output of a script
in a file??
Thank´s a lot;
You seem to have CSS turned off.
Please don't fill out this field.
The scripting guide can be found here
But warning, it is written using extreme techno-babble and many(most?) of the
functions don't work and unfortunately they don't tell you (i.e. with an
"Under Construction" sign) which ones are functioning and which ones aren't.
Writing the output of a script to a file I don't think is possible, but if you
figure it out do post back.
As the "they" author of most of the scripting engine documentation, I invite
anyone who wishes to improve the documentation to do so. We are grateful for
any contributions we get. The whole project is not yet complete, hence the <
1.0 version number.
With respect to writing out a file, no that is not possible. This is not an
accident - the scripting engine is sandboxed in an attempt to prevent a whole
category of security problems which can arise by letting the scripting engine
edit files on your computer. Just look at acrobat reader. Do not want.
How about writing text to the log file?
As in the StelLogger Class
For instance, suppose I have script that goes move time forward until the sun
sets, once it reaches the sun set could I write the Julian date in the log
file? If I run the sunset script for a hundred years or more can I send the
dates to the log.txt file? The log file will get pretty big but I can also
open it in notepad and cut and paste what I need
Well I tried
and just plain
None of them worked. So I guess this isn't working
When there's a will there's a way, I found a backdoor way of outputting data
You can use the core.setDate() function to send data to the last run log, the
For example, if you use this line in a script
core.setDate("*Lets go Mets*");
in the log file, a this line will appear
StelMainScriptAPI::jdFromDateString error: date string "*Let's go Mets*"
not recognised, returning "now"
Just open the log.txt file and remove all the top system information and
replace everything before and after the "Let's go Mets" and you have your data
Here's an example script, that when you run it it will record the date and
Mars' RA and Dec in the Last Run Log
Mars to log.ssc
Ok, try again
Here's the script file
http://www.lowerwolfjaw.com/astro/Stellarium/Mars to log.ssc
And sorry, I don't know why my post have lots of space below them
One last try
Nice hack qam1 :) I think I will implement a "writeLogMessage" function in the
core object at some point. Be aware that I will probably put a limit on the
length of data passed - perhaps a 1000 characters or something like that. What
do you think?
I use an indirect way through the script console and core.debug, then copy and
paste to a file.
Open the script console and run your script from there.
then copy and paste into your file.
Ex. to output moon altitude every 30 Sec.
for (i=0; i<20; i++)
MoonData = core.getObjectPosition("Moon");
MoonAlt = MoonData
The writeLogMessage sounds like a good idea. I assume 1000 characters per
message instead of total 1000 which is probably more than enough.
One problem with my system is the error message is lots of words, so the file
size of the log.txt file could get unwieldy.
You could also instead of writing to the log.txt file, you could have a
separate dedicated file just for script output. Call it scriptoutput.txt or
something. This way you can keep your data over multiple runs of Stellarium.
i must say that is necessary to have a legal way to save the data to a file. Not cover the hacks with dirt or erase the answers. in new version 0.12.4 cant be done.
Sign up for the SourceForge newsletter: