[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lua & external DOS executable applications



--- In femm@xxxxxxxxxxxxxxx, "ac090960 <ac090960@xxxx>"
<ac090960@xxxx> wrote:
> Hello, 
> First of all Happy New Year,
> 
> I wondering if is possible to run external applications ( DOS 
> executables compiled from FORTRAN codes) inside a LUA session.
> I mean: is it possible with a LUA script run iteratively a FEMM 
> problem calling after a femm calculation a DOS application ( xxx.exe) 
> (e.g.: the application able to manipulate some FEMM output) and then 
> ( after a FEMM geometry modification) run the new femm problem and so 
> on?
> 
> If it is not possible make this external call in LUA are there any 
> other way to run iteratively FEMM "linking/calling it" with 
> external DOS applications ?
> 
> Any help and suggestion on this matter ( linking & calling FEMM with 
> DOS application) is welcome
> 
> Thanks in advance for reply,
> Arnoldo

Yes, it is possible to call other executable programs from within a
lua script using the "execute" command that's built into lua. For
example, you could enter:

execute("dir c:\\windows | more")

into the lua console and evaluate it. A DOS window would then pop up
displaying all the files in your c:\windows directory. The only trick
to it is that all back-slashed in the command line have to be replaced
by double back-slashes. For example, if you had some program that
lived at c:\temp\program.exe, you'd have to use the line:

execute("c:\\temp\\program.exe") 

to run it from your lua script.

You can also go the other way, calling a femm analysis from just about
any program. There is an example of calling femm out of a matlab or
mathematica program at http://femm.berlios.de/roters1b.zip
You call the preprocessor with the name of a lua script that you want
it to run. For example, the Mathematica version does this with:

Run["c:\\progra~1\\femm32\\bin\\femme.exe
-lua-script=c:\\temp\\roters1b\\roters1b-pre.lua -windowhide"];

In fortran, I think that the analog to Mathematica's Run command is
"call system".

Dave.