Page 1 of 1

Is there any way to call an exe file from a celx script??

Posted: 15.03.2008, 19:04
by MARKS
Hello all, I'm trying to use a matlab function to get an XYZ file and I'd like to call this function from a celx script. I've read lots of topics related with this issue, but I haven't got any answer to my question. So, if anybody can tell me any information about that, i'll be very grateful.
Sorry for my English.
Thank you all.

Re: Is there any way to call an exe file from a celx script?

Posted: 16.03.2008, 11:28
by Vincent
MARKS,

You can use os.execute(filename) to run any filename from a celx script.

However, since this requires access to the Lua os library, you must first set ScriptSystemAccessPolicy to "allow" in celestia.cfg, and add the following lines at the beginning of your celx script:

Code: Select all

celestia:requestsystemaccess()
wait(0)


Then, if your .exe file is placed in a subfolder of the "Program Files" folder, I'd suggest to use a short batch file, such as:

Code: Select all

cd %ProgramFiles%\XYZFolder
XYZ.exe
Just replace XYZFolder and XYZ.exe with the names corresponding to your XYZ program.
You can save this batch file as "runXYZ.bat" in your celestia base folder.

Then, you'll be able to launch your XYZ program from your celx script using:

Code: Select all

os.execute("runXYZ")

Posted: 25.03.2008, 18:04
by MARKS
Thank you Vincent for your answer, it works perfectly. :D

Posted: 25.03.2008, 18:11
by Vincent
MARKS wrote:Thank you Vincent for your answer, it works perfectly. :D

You're welcome Marks.