FlightGear's Nasal doesn't support running external commands. Partly because it's too dangerous, but also because Nasal's "unix" module isn't fully cross-platform (read: Windows isn't good enough for it ;-)
On Unices (Linux, OSX) it's fairly trivial to implement this feature and to keep it sufficiently secure. Let's implement a key binding that opens Google Maps in FireFox for the current location: 1) Make a FIFO: $ mkdir -p ~/.fgfs/Export && mkfifo ~/.fgfs/Export/cmdfifo 2) Write a script that scans the FIFO (attached). Always start it together with fgfs. Add it to your fgfs start script (if you have one) or make an alias: $ alias fgfs="fgfs.fifo.runner & fgfs; kill $(/sbin/pidof -x fgfs.fifo.runner) &>/dev/null" 3) Add a Nasal exec() function somewhere, for example in ~/.fgfs/Nasal/local.nas, which writes to the FIFO: globals.exec = func { var f = io.open(getprop("/sim/fg-home") ~ "/Export/cmdfifo", "w"); io.write(f, call(sprintf, arg) ~ "\n"); io.close(f); } The "globals." prefix makes the function globally available without prefix. The function can be used with printf()-like formats: exec("some-command --in %s --out %s", arg1, arg2); 4) And to a key definition of your choice add this binding: <binding> <command>nasal</command> <script> var lat = getprop("/position/latitude-deg"); var lon = getprop("/position/longitude-deg"); exec("openurl http://maps.google.com/maps?ll=%.10f,%.10f&z=12&t=h", lat, lon); </script> </binding> To prevent abuse, the fgfs.fifo.runner script only runs a hard-coded set of commands and doesn't hand anything over to eval or a subshell. If you like, make the fifo harder to find by putting it somewhere else and giving it a non-guessable name. Just make sure to add a WRITE rule for it to $FG_ROOT/Nasal/IOrules then. (The ~/.fgfs/Export/ directory is write-enabled by default.) m.
fgfs.fifo.runner
Description: application/shellscript
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel