Index: /trunk/FACT++/src/Readline.cc
===================================================================
--- /trunk/FACT++/src/Readline.cc	(revision 13667)
+++ /trunk/FACT++/src/Readline.cc	(revision 13668)
@@ -71,5 +71,5 @@
 
 Readline *Readline::This   =  0;
-int       Readline::fLabel = -1;
+int       Readline::fLabel = -2;
 
 // --------------------------------------------------------------------------
@@ -952,6 +952,6 @@
     fprintf(rl_outstream, "   .! command   Execute a shell command\n");
     fprintf(rl_outstream, "   .w n         Sleep n milliseconds\n");
-    fprintf(rl_outstream, "   .x filename  Execute a script of commands\n");
-    fprintf(rl_outstream, "   .x file:N    Execute a script of commands, start at label N\n");
+    fprintf(rl_outstream, "   .x file ..   Execute a script of commands (+optional argumnets)\n");
+    fprintf(rl_outstream, "   .x file:N .. Execute a script of commands, start at label N\n");
     fprintf(rl_outstream, "   .j N         Forward jump to label N\n");
     fprintf(rl_outstream, "   : N          Defines a label\n");
@@ -1046,5 +1046,18 @@
     if (str.substr(0, 3)==".x ")
     {
-         Execute(str.substr(3));
+        string opt(str.substr(3));
+
+        map<string,string> data = Tools::Split(opt);
+        if (data.size()==0)
+            return false;
+
+        /*
+            if (fData.size()==0)
+                // File name missing ...
+            else
+                // "Equal sign missing in argument '"+data.begin()->first+"'"
+         */
+
+         Execute(opt, data);
          return true;
     }
@@ -1219,10 +1232,17 @@
 //!    Filename of file to read
 //!
+//! @param args
+//!    Arguments to be passed to the script. A search and replace
+//!    will be done for ${arg}
+//!
 //! @returns
 //!    -1 if the file couldn't be read and the number of commands for which
 //!    Process() was callled otherwise
 //!
-int Readline::Execute(const string &fname)
-{
+int Readline::Execute(const string &fname, const map<string,string> &args)
+{
+    // this could do the same:
+    //    rl_instream = fopen(str.c_str(), "r");
+
     if (IsStopped())
         return 0;
@@ -1242,5 +1262,8 @@
     ifstream fin(name.c_str());
     if (!fin)
+    {
+        SetSection(-2);
         return -1;
+    }
 
     fCommandLog << "# " << Time() << " - " << name << " (START";
@@ -1248,4 +1271,6 @@
         fCommandLog << ':' << fLabel;
     fCommandLog << ")" << endl;
+
+    SetSection(0);
 
     int rc = 0;
@@ -1266,9 +1291,18 @@
         }
 
+        // find and replace arguments
+        for (auto it=args.begin(); it!=args.end(); it++)
+        {
+            const string find = "${"+it->first+"}";
+            for (size_t pos=0; (pos=buffer.find(find, pos))!=string::npos; pos+=find.length())
+                buffer.replace(pos, find.size(), it->second);
+        }
+
+        // process line
         ProcessLine(buffer);
     }
 
     fLabel = -1;
-    SetSection(-1);
+    SetSection(-2);
 
     fCommandLog << "# " << Time() << " - " << name << " (FINISHED)" << endl;
Index: /trunk/FACT++/src/Readline.h
===================================================================
--- /trunk/FACT++/src/Readline.h	(revision 13667)
+++ /trunk/FACT++/src/Readline.h	(revision 13668)
@@ -2,4 +2,5 @@
 #define FACT_Readline
 
+#include <map>
 #include <string>
 #include <vector>
@@ -95,5 +96,5 @@
     static  void Stop();
     virtual bool ExecuteShellCommand(const std::string &cmd);
-    int          Execute(const std::string &fname);
+    int          Execute(const std::string &fname, const std::map<std::string,std::string> &args=std::map<std::string,std::string>());
     bool         IsStopped() const;
     void         ProcessLine(const std::string &str);
@@ -125,4 +126,5 @@
     int GetRows() const;
 
+    static Readline *Instance() { return This; }
 };
 
Index: /trunk/FACT++/src/ReadlineColor.cc
===================================================================
--- /trunk/FACT++/src/ReadlineColor.cc	(revision 13667)
+++ /trunk/FACT++/src/ReadlineColor.cc	(revision 13668)
@@ -160,5 +160,5 @@
     out << kBold << "   .! command   " << kReset << "Execute a shell command\n";
     out << kBold << "   .w n         " << kReset << "Sleep n milliseconds\n";
-    out << kBold << "   .x filename  " << kReset << "Execute a script of commands\n";
+    out << kBold << "   .x filename  " << kReset << "Execute a script of commands (+optional arguments)\n";
     out << kBold << "   .x file:N    " << kReset << "Execute a script of commands, start at label N\n";
     out << kBold << "   .j N         " << kReset << "Forward jump to label N\n";
