Index: /trunk/FACT++/scripts/doc/dim.js
===================================================================
--- /trunk/FACT++/scripts/doc/dim.js	(revision 17497)
+++ /trunk/FACT++/scripts/doc/dim.js	(revision 17498)
@@ -115,5 +115,7 @@
  * @param {String} name
  *     The name of the server of which you want to wait for a state.
- *     The name must not contain quotation marks.
+ *     The name must not contain quotation marks. To wait for
+ *     "not the given state", prefix the server name with an
+ *     exclamation mark, e.g. "!DIM_CONTROL"
  *
  * @param {String,Integer} state
Index: /trunk/FACT++/src/InterpreterV8.cc
===================================================================
--- /trunk/FACT++/src/InterpreterV8.cc	(revision 17497)
+++ /trunk/FACT++/src/InterpreterV8.cc	(revision 17498)
@@ -362,4 +362,6 @@
     const string state   = args[1]->IsString() ? *String::AsciiValue(args[1]) : "";
     const string arg1    = args[1]->IsString() ? ("\""+state+"\"") : to_string(args[1]->Int32Value());
+    const bool   isNot   = arg0[0]=='!';
+    const string name    = isNot ? arg0.substr(1) : arg0;
 
     if (arg0.find_first_of("\"'")!=string::npos)
@@ -377,5 +379,8 @@
                       "{"
                          "var s = dim.state(name);"
-                         "if(!s)throw new Error('Waiting for state "+arg1+" of server "+arg0+" failed.');"
+                         "if(!s)throw new Error('Waiting for state "+arg1+" of server "+arg0+" failed.');";
+    if (isNot)
+                         "if(state=="+index+")return true;";
+    else
                          "if(state=="+index+")return true;";
     if (timeout)
@@ -387,5 +392,5 @@
         code +=    "if(ms>0)throw new Error('Waiting for state "+arg1+" of server "+arg0+" timed out.');";
     code +=        "return false;"
-                   "})('"+arg0+"',"+arg1;
+                   "})('"+name+"',"+arg1;
     if (timeout)
         code +=    "," + (args[2]->IsUndefined()?"undefined":to_string(args[2]->Int32Value()));
