Index: src/Actions/ActionSequence.cpp
===================================================================
--- src/Actions/ActionSequence.cpp	(revision bcb59318252793f08bc2b15503ba6a7588e19614)
+++ src/Actions/ActionSequence.cpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -43,5 +43,6 @@
 using namespace MoleCuilder;
 
-ActionSequence::ActionSequence()
+ActionSequence::ActionSequence() :
+    loop(1)
 {}
 
@@ -78,9 +79,10 @@
 // Each action registers itself with the history
 void ActionSequence::callAll(){
-  for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){
-    // we want to have a global bookkeeping for all actions in the sequence, so
-    // we bypass the normal call
-    (*it)->call();
-  }
+  for (int i=0;i<loop;++i)
+    for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){
+      // we want to have a global bookkeeping for all actions in the sequence, so
+      // we bypass the normal call
+      (*it)->call();
+    }
 }
 
@@ -90,10 +92,11 @@
 ActionSequence::stateSet ActionSequence::callAll(bool){
   stateSet states;
-  for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){
-    // we want to have a global bookkeeping for all actions in the sequence, so
-    // we bypass the normal call
-    Action::state_ptr state = (*it)->performCall();
-    states.push_back(state);
-  }
+  for (int i=0;i<loop;++i)
+    for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){
+      // we want to have a global bookkeeping for all actions in the sequence, so
+      // we bypass the normal call
+      Action::state_ptr state = (*it)->performCall();
+      states.push_back(state);
+    }
   return states;
 }
Index: src/Actions/ActionSequence.hpp
===================================================================
--- src/Actions/ActionSequence.hpp	(revision bcb59318252793f08bc2b15503ba6a7588e19614)
+++ src/Actions/ActionSequence.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -36,4 +36,6 @@
   void addAction(Action*);
   Action* removeLastAction();
+  unsigned int getLoop() const
+  { return loop; }
 
   void callAll();
@@ -47,6 +49,10 @@
   stateSet undoAll(stateSet);
   stateSet redoAll(stateSet);
+  void setLoop(unsigned int _loop)
+  { loop = _loop; }
 private:
   actionSet actions;
+  //!> how often the sequence is repeated
+  unsigned int loop;
 };
 
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision bcb59318252793f08bc2b15503ba6a7588e19614)
+++ src/Actions/Makefile.am	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -36,4 +36,6 @@
   Actions/GlobalListOfActions.hpp \
   Actions/MakroAction.hpp \
+  Actions/MakroAction_impl_header.hpp \
+  Actions/MakroAction_impl_pre.hpp \
   Actions/ManipulateAtomsProcess.hpp \
   Actions/MethodAction.hpp \
Index: src/Actions/MakroAction.cpp
===================================================================
--- src/Actions/MakroAction.cpp	(revision bcb59318252793f08bc2b15503ba6a7588e19614)
+++ src/Actions/MakroAction.cpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -40,6 +40,9 @@
 #include "Actions/MakroAction.hpp"
 #include "Actions/Action.hpp"
+#include "Actions/ActionExceptions.hpp"
 #include "Actions/ActionSequence.hpp"
 #include "CodePatterns/Assert.hpp"
+#include "UIElements/Dialog.hpp"
+#include "UIElements/UIFactory.hpp"
 
 using namespace MoleCuilder;
@@ -78,4 +81,9 @@
 {}
 
+void MakroAction::setLoop(unsigned int _loop)
+{
+  actions.setLoop(_loop);
+}
+
 Dialog* MakroAction::fillDialog(Dialog *dialog) {
   return actions.fillAllDialogs(dialog);
@@ -83,4 +91,14 @@
 
 Action::state_ptr MakroAction::performCall(){
+  {
+    // create and run our dialog and also of all members of the sequence
+    Dialog* dialog = actions.fillAllDialogs(createDialog());
+    if (dialog->hasQueries()) {
+      if (!dialog->display())
+        // dialog error or aborted -> throw exception
+        throw ActionFailureException() << ActionNameString(getName());
+    }
+    delete(dialog);
+  }
   ActionSequence::stateSet states = actions.callAll(true);
   return Action::state_ptr(new MakroActionState(states));
Index: src/Actions/MakroAction.hpp
===================================================================
--- src/Actions/MakroAction.hpp	(revision bcb59318252793f08bc2b15503ba6a7588e19614)
+++ src/Actions/MakroAction.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -49,4 +49,6 @@
   virtual Action::state_ptr performRedo(Action::state_ptr);
 
+  void setLoop(unsigned int _loop);
+
 private:
   ActionSequence &actions;
Index: src/Actions/MakroAction_impl_header.hpp
===================================================================
--- src/Actions/MakroAction_impl_header.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
+++ src/Actions/MakroAction_impl_header.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -0,0 +1,282 @@
+/*
+ * Action_impl_header.hpp
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/debug/assert.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/list/adt.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/punctuation/paren.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/push_back.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/seq/transform.hpp>
+
+#include <iostream>
+#include <typeinfo>
+
+#include "Actions/ActionSequence.hpp"
+#include "Actions/ActionTraits.hpp"
+
+#include "Parameters/Parameter.hpp"
+
+// some derived names: if CATEGORY is not given, we don't prefix with it
+#ifdef CATEGORY
+#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
+#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
+#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
+#else
+#define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
+#define COMMAND ACTIONNAME
+#define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
+#endif
+// check if no lists given
+#ifndef paramtypes
+#define MAXPARAMTYPES 0
+#else
+#define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
+#endif
+#ifndef paramdefaults
+#define MAXPARAMDEFAULTS 0
+// this is required for valid_print "else part"
+#define sequencer(z,n,data) \
+  BOOST_PP_SEQ_PUSH_BACK( data, NOPARAM_DEFAULT)
+#define paramdefaults BOOST_PP_REPEAT( MAXPARAMTYPES, sequencer, BOOST_PP_SEQ_NIL )
+#else
+#define MAXPARAMDEFAULTS BOOST_PP_SEQ_SIZE(paramdefaults)
+#endif
+#define PARAM_DEFAULT(x) \
+    (x, BOOST_PP_NIL)
+
+// check user has given name and category
+#ifndef ACTIONNAME
+ERROR: No "ACTIONNAME" defined in: __FILE__
+#endif
+
+// calculate numbers and check whether all have same size
+#ifdef paramtokens
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramtokens)),\
+  ERROR: There are not the same number of "paramtokens" and "paramtypes" in: __FILE__ \
+)
+#endif
+#ifdef paramreferences
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\
+  ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \
+)
+#endif
+#ifdef paramdescriptions
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdescriptions)),\
+  ERROR: There are not the same number of "paramtokens" and "paramdescriptions" in: __FILE__ \
+)
+#endif
+
+// check for mandatory defines
+#ifndef DESCRIPTION
+BOOST_PP_ASSERT_MSG(0, \
+    "ERROR: Description is mandatory for Actions, here for ACTION " \
+)
+#endif
+
+// check if paramdefaults is given, otherwise fill list with NOPARAM_DEFAULT
+// this does not work: paramdefaults has to be completely defined before
+// being used within option_print (used as an array there and not as
+// some function call still to be expanded)
+//#define paramdefaults (NOPARAM_DEFAULT)
+//#define tempvalue(z,n,value)
+//  BOOST_PP_CAT(value,(NOPARAM_DEFAULT))
+//BOOST_PP_REPEAT(tempvalue, MAXPARAMTYPES, paramdefaults)
+//#undef tempvalue
+//#else
+
+// if present, check if correct number of arguments
+#ifdef paramdefaults
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdefaults)),\
+  ERROR: There are not the same number of "paramtokens" and "paramdefaults" in: __FILE__ \
+)
+#endif
+
+// print a list of type ref followed by a separator, i.e. "Parameter<int> i;"
+#define type_print(z,n,TYPELIST, VARLIST, separator) \
+  Parameter < \
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  > \
+  BOOST_PP_SEQ_ELEM(n, VARLIST) \
+  separator
+
+// print a list of type ref followed, i.e. "int i, double position"
+#define type_list(z,n,TYPELIST, VARLIST) \
+  BOOST_PP_COMMA_IF(n)\
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)
+
+// prints Options.insert
+#define option_print(z,n,unused, unused2) \
+  tester = Options. insert (\
+      std::pair< std::string, OptionTrait *> ( \
+      BOOST_PP_SEQ_ELEM(n, paramtokens), \
+      new OptionTrait(\
+          BOOST_PP_SEQ_ELEM(n, paramtokens), \
+          &typeid( BOOST_PP_SEQ_ELEM(n, paramtypes) ), \
+          BOOST_PP_SEQ_ELEM(n, paramdescriptions) \
+          BOOST_PP_COMMA_IF( BOOST_PP_NOT( BOOST_PP_LIST_IS_NIL( BOOST_PP_SEQ_ELEM(n, paramdefaults) ) ) ) \
+          BOOST_PP_EXPR_IF( \
+              BOOST_PP_NOT( BOOST_PP_LIST_IS_NIL( BOOST_PP_SEQ_ELEM(n, paramdefaults) ) ), \
+              toString BOOST_PP_LPAREN() \
+                  BOOST_PP_LIST_FIRST( BOOST_PP_SEQ_ELEM(n, paramdefaults) )) \
+              BOOST_PP_RPAREN() \
+          )\
+      )\
+  ); \
+  ASSERT(tester.second, "ActionTrait<ACTION>::ActionTrait<ACTION>() option token present twice!");
+
+namespace MoleCuilder {
+
+void COMMAND(
+#if defined paramtypes && defined paramreferences
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+    );
+
+class ACTION;
+
+template <>
+class ActionTraits<ACTION> : public ActionTrait {
+public:
+  ActionTraits() :
+#ifndef SHORTFORM
+    ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string()))
+#else
+    ActionTrait(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string(), SHORTFORM))
+#endif /* SHORTFORM */
+  {
+  // initialize remainder of action info
+#ifdef MENUNAME
+    MenuTitle = MENUNAME;
+#endif
+#ifdef MENUPOSITION
+    MenuPosition = MENUPOSITION;
+#endif
+
+    // initialize action's options
+    std::pair< ActionTrait::options_iterator, bool > tester;
+#ifdef paramtokens
+#define BOOST_PP_LOCAL_MACRO(n) option_print(~, n, ~, )
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+    // associate action's short form also with option
+#ifdef SHORTFORM
+    if (Options.find(TOKEN) != Options.end())
+      Options[TOKEN]->setShortForm(std::string(SHORTFORM));
+#endif /* SHORTFORM */
+    //std::cout << "ActionTraits<" << BOOST_PP_STRINGIZE(ACTION) << ">::ActionTraits() on instance " << this << " with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
+  }
+
+  virtual ~ActionTraits() {
+    //std::cout << "ActionTraits<" << BOOST_PP_STRINGIZE(ACTION) << ">::~ActionTraits() on instance " << this << " with name " << getName() << " called." << std::endl;
+  }
+};
+
+class ACTION : public MakroAction {
+  #if defined paramtypes && defined paramreferences
+  friend void COMMAND(
+  #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+  #include BOOST_PP_LOCAL_ITERATE()
+      );
+  # else
+  void COMMAND();
+  #endif
+
+public:
+  ACTION();
+  virtual ~ACTION();
+
+  // must be called after all primitive actions are present
+  void prepare(ActionRegistry &AR);
+  // must be called before alle primitive actions are removed
+  void unprepare(ActionRegistry &AR);
+
+  bool canUndo();
+  bool shouldUndo();
+
+  struct PARAMS : ActionParameters {
+    //!> constructor for class PARAMS, setting valid ranges
+    PARAMS();
+    //!> copy constructor for class PARAMS, setting valid ranges
+    PARAMS(const PARAMS &p);
+  #if defined paramtypes && defined paramreferences
+  #define BOOST_PP_LOCAL_MACRO(n) type_print(~, n, paramtypes, paramreferences, ;)
+  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+  #include BOOST_PP_LOCAL_ITERATE()
+  #endif
+  } params;
+
+protected:
+  virtual Dialog * fillDialog(Dialog*);
+
+  void startTimer() const;
+  void endTimer() const;
+
+private:
+  //!> flag to check whether actions have been prepared
+  static bool isPrepared;
+  //!> sequence of actions for this macro action
+  static ActionSequence actions;
+
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+};
+
+}
+
+#undef paramvalids
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+#undef paramdescriptions
+#undef paramdefaults
+#undef MAXPARAMTYPES
+#undef MAXPARAMDEFAULTS
+#undef statetypes
+#undef statereferences
+#undef MAXSTATETYPES
+#undef PARAM_DEFAULT
+
+#undef option_print
+#undef sequencer
+#undef type_print
+#undef type_list
+
+#undef ACTION
+#undef COMMAND
+#undef COMMANDFULL
+#undef PARAMS
+
+#undef ACTIONNAME
+#undef CATEGORY
+#undef MENUNAME
+#undef MENUPOSITION
+#undef TOKEN
+
+#undef DESCRIPTION
+#undef SHORTFORM
Index: src/Actions/MakroAction_impl_pre.hpp
===================================================================
--- src/Actions/MakroAction_impl_pre.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
+++ src/Actions/MakroAction_impl_pre.hpp	(revision 9c1324fae3f2f64ced647028e764fc50c0b40370)
@@ -0,0 +1,354 @@
+/*
+ * Action_impl.hpp
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+/** These macros define the following functions, necessary but repetitive for
+ * every Action:
+ *  -# Dialog* fillDialog()
+ *  -# action command (e.g. AnalysisMolecularVolume() )
+ *  -# void getParametersfromValuStorage()
+ *  -# struct Action...Parameters
+ *
+ *  For this, the user has the define the following values, each with
+ *  parenthesis, for the values/parameters the action needs
+ *  -# paramtypes, e.g. (int)(double)
+ *  -# paramtokens, e.g. ("Z")("length")
+ *  -# paramreferences, e.g. (Z)(length)
+ *  and for additional values/parameters to save in the state
+ *  -# statetypes, e.g. (int)(double)
+ *  -# statereferences, e.g. (Z)(length)
+ *  and the name and category of the action
+ *  -# CATEGORY, e.g. Analysis
+ *  -# ACTIONNAME, e.g. MolecularVolume
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/Chronos.hpp"
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/expand.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/debug/assert.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/list/adt.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/push_back.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/seq/transform.hpp>
+
+#include "Parameters/Parameter.hpp"
+
+
+// some derived names: if CATEGORY is not given, we don't prefix with it
+#ifdef CATEGORY
+#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
+#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
+#define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State))
+#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
+#else
+#define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
+#define COMMAND ACTIONNAME
+#define STATE BOOST_PP_CAT(ACTIONNAME, State)
+#define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
+#endif
+#define INSTANCE BOOST_PP_CAT(this_, BOOST_PP_CAT(ACTIONNAME, _instance))
+
+// check if no lists given
+#ifndef paramtypes
+#define MAXPARAMTYPES 0
+#else
+#define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
+#endif
+#ifndef statetypes
+#define MAXSTATETYPES 0
+#else
+#define MAXSTATETYPES BOOST_PP_SEQ_SIZE(statetypes)
+#endif
+#ifndef paramdefaults
+#define MAXPARAMDEFAULTS 0
+// this is required for valid_print "else part"
+#define sequencer(z,n,data) \
+  BOOST_PP_SEQ_PUSH_BACK( data, NOPARAM_DEFAULT)
+#define paramdefaults BOOST_PP_REPEAT( MAXPARAMTYPES, sequencer, BOOST_PP_SEQ_NIL )
+#else
+#define MAXPARAMDEFAULTS BOOST_PP_SEQ_SIZE(paramdefaults)
+#endif
+#define PARAM_DEFAULT(x) \
+    (x, BOOST_PP_NIL)
+
+// check user has given name and category
+#ifndef ACTIONNAME
+ERROR: No "ACTIONNAME" defined in: __FILE__
+#endif
+
+// calculate numbers and check whether all have same size
+#ifdef paramtokens
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramtokens)),\
+  ERROR: There are not the same number of "paramtokens" and "paramtypes" in: __FILE__ \
+)
+#endif
+#ifdef paramreferences
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\
+  ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \
+)
+#endif
+
+#ifdef statetypes
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXSTATETYPES, BOOST_PP_SEQ_SIZE(statereferences)),\
+  ERROR: There are not the same number of "statetypes" and "statereferences" in: __FILE__ \
+)
+#endif
+
+// print a list of type ref followed by a separator, i.e. "int i;"
+#define initialiser_print(z,n,initialiserlist) \
+  BOOST_PP_SEQ_ELEM(n, initialiserlist) \
+  (BOOST_PP_CAT(_, BOOST_PP_SEQ_ELEM(n, initialiserlist))),
+
+// print a list of ref(_ref) followed by a separator, i.e. "id(_id),"
+#define type_print(z,n,TYPELIST, VARLIST, separator) \
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)\
+  separator
+
+// print a list of type ref followed, i.e. "int i, double position"
+#define type_list(z,n,TYPELIST,VARLIST) \
+  BOOST_PP_COMMA_IF(n)\
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)
+
+// prints dialog->query calls for paramtypes with tokens
+#define dialog_print(z,n,unused) \
+  dialog->query<\
+  BOOST_PP_SEQ_ELEM(n, paramtypes)\
+  >( params. \
+  BOOST_PP_SEQ_ELEM(n, paramreferences)\
+  ,\
+  BOOST_PP_SEQ_ELEM(n, paramtokens)\
+  , Traits.getDescription()\
+  );
+
+// print an initialiser list, i.e. "var( token, valid (,default) )(,)"
+#define valid_print(z,n,TOKENLIST, VARLIST, VALIDLIST, DEFAULTLIST) \
+  BOOST_PP_COMMA_IF(n) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST) \
+  ( \
+  BOOST_PP_SEQ_ELEM(n, TOKENLIST) \
+  , \
+  BOOST_PP_SEQ_ELEM(n, VALIDLIST) \
+  BOOST_PP_COMMA_IF( BOOST_PP_NOT( BOOST_PP_LIST_IS_NIL( BOOST_PP_SEQ_ELEM(n, DEFAULTLIST) ) ) ) \
+  BOOST_PP_EXPR_IF( \
+      BOOST_PP_NOT( BOOST_PP_LIST_IS_NIL( BOOST_PP_SEQ_ELEM(n, DEFAULTLIST) ) ), \
+      BOOST_PP_LIST_FIRST( BOOST_PP_SEQ_ELEM(n, DEFAULTLIST) )) \
+  )
+
+// print an initialiser list, i.e. "var( valid . var )(,)"
+#define validcopy_print(z,n,TOKENLIST, VARLIST, VALID) \
+  BOOST_PP_COMMA_IF(n) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST) \
+  ( \
+  VALID . \
+  BOOST_PP_SEQ_ELEM(n, VARLIST) \
+  )
+
+// prints set/queryCurrentValue (command) for paramreferences and paramtokens
+#define value_print(z, n, container, prefix) \
+  prefix \
+  BOOST_PP_SEQ_ELEM(n, container)\
+  .set(\
+  BOOST_PP_SEQ_ELEM(n, container)\
+  );
+
+// prints set/queryCurrentValue (command) for paramreferences and paramtokens
+#define valuetype_print(z,n,container, types, prefix) \
+  prefix \
+  BOOST_PP_SEQ_ELEM(n, container) \
+  .setAsString( \
+  BOOST_PP_SEQ_ELEM(n, container) \
+  );
+
+#define stringtype std::string
+
+#define type2string(s, data, elem) \
+	stringtype
+
+
+#include "Actions/ActionRegistry.hpp"
+//#include "Actions/ActionTraits.hpp"
+#include "UIElements/Dialog.hpp"
+
+#ifdef paramtokens
+#define statenecessary 1
+#endif
+#ifndef statetokens
+#define statenecessary 1
+#endif
+
+namespace MoleCuilder {
+
+// =========== memento to remember the state when undoing ===========
+#ifdef statenecessary
+class STATE : public ActionState {
+public:
+  STATE(
+#if defined statetypes && defined statereferences // if we have parameters, we have to add "_" before each reference and add the params as the last one
+#define OP(s,data,elem) BOOST_PP_CAT(data, elem)  // OP to add "_"
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, BOOST_PP_SEQ_PUSH_BACK(statetypes, const ACTION::PARAMS &), BOOST_PP_SEQ_TRANSFORM(OP, _, BOOST_PP_SEQ_PUSH_BACK(statereferences, params)))
+#else /// if not, params is only list
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, (const ACTION::PARAMS &), (_params))
+#endif
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXSTATETYPES)
+#include BOOST_PP_LOCAL_ITERATE()
+) :
+#if defined statetypes && defined statereferences // do we have parameters at all?
+BOOST_PP_REPEAT(MAXSTATETYPES, initialiser_print, statereferences)
+#endif
+params(_params)
+  {}
+
+#if defined statetypes && defined statereferences // do we have parameters at all?
+#define BOOST_PP_LOCAL_MACRO(n) type_print(~, n, statetypes, statereferences, ;)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXSTATETYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+  ACTION::PARAMS params;
+};
+#endif /* statenecessary */
+
+// (const) prototype to be placed into the ActionRegistry (must be deleted by registry itself)
+//const ACTION INSTANCE;
+//boost::shared_ptr< ACTION > INSTANCE( new ACTION() );
+
+// =========== constructor ===========
+ACTION::ACTION () :
+  MakroAction(ActionTraits< ACTION >(), actions, false)
+{}
+
+// =========== destructor ===========
+ACTION::~ACTION ()
+{
+  //std::cout << "Action ACTION is being destroyed." << std::endl;
+}
+
+// =========== parameter constructor ===========
+ACTION::PARAMS::PARAMS()
+#if defined paramtokens && defined paramreferences && defined paramvalids
+      :
+#define BOOST_PP_LOCAL_MACRO(n) valid_print(~, n, paramtokens, paramreferences, paramvalids, paramdefaults)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+    {}
+
+ACTION::PARAMS::PARAMS(const PARAMS &p)
+#if defined paramtokens && defined paramreferences
+      :
+#define BOOST_PP_LOCAL_MACRO(n) validcopy_print(~, n, paramtokens, paramreferences, p)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+    {}
+
+// =========== fill a dialog ===========
+Dialog* ACTION::fillDialog(Dialog *dialog) {
+        ASSERT(dialog,"No Dialog given when filling actionname's dialog");
+#if BOOST_PP_EQUAL(MAXPARAMTYPES,0)
+        dialog->queryEmpty(TOKEN, Traits.getDescription());
+#else
+#define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+        return dialog;
+};
+
+// =========== time the action ===========
+// we need this here to have the correct function name
+void ACTION::startTimer() const { Chronos::getInstance().startTiming( std::string( TOKEN ) ); }
+void ACTION::endTimer() const { Chronos::getInstance().endTiming( std::string( TOKEN ) ); }
+
+// =========== command for calling action directly ===========
+void COMMAND(
+#if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+)
+{
+  ACTION *ToCall = dynamic_cast<ACTION*>(ActionRegistry::getInstance().getActionByName( TOKEN )); //->clone(params);
+  //ACTION::PARAMS params;
+#if defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, paramreferences, ToCall->params.)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+  ToCall->call(Action::NonInteractive);
+};
+
+void BOOST_PP_CAT( COMMAND, _stringargs)(
+#if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, BOOST_PP_SEQ_TRANSFORM( type2string, , paramtypes), paramreferences)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+	) {
+  ACTION *ToCall = dynamic_cast<ACTION*>(ActionRegistry::getInstance().getActionByName( TOKEN )); //->clone(params);
+  //ACTION::PARAMS params;
+#if defined paramtypes && defined paramtypes && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) valuetype_print(~, n, paramreferences, paramtypes, ToCall->params. )
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+  ToCall->call(MoleCuilder::Action::NonInteractive);
+};
+
+}
+
+// free up defines
+#undef paramvalids
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+#undef paramdescriptions
+#undef paramdefaults
+#undef MAXPARAMTYPES
+#undef MAXPARAMDEFAULTS
+#undef statetypes
+#undef statereferences
+#undef MAXSTATETYPES
+#undef PARAM_DEFAULT
+
+#undef type2string
+#undef stringtype
+#undef initialiser_print
+#undef type_print
+#undef type_list
+#undef dialog_print
+#undef sequencer
+#undef valid_print
+#undef validcopy_print
+#undef value_print
+#undef valuetype_print
+
+#undef ACTION
+#undef COMMAND
+#undef PARAMS
+#undef STATE
+#undef INSTANCE
+
+#undef ACTIONNAME
+#undef CATEGORY
+#undef TOKEN
