Index: trunk/FACT++/scripts/Main.js
===================================================================
--- trunk/FACT++/scripts/Main.js	(revision 14763)
+++ trunk/FACT++/scripts/Main.js	(revision 14764)
@@ -359,10 +359,16 @@
 
 // All times are in UTC
+// NEW SYNTAX:   "date", "MODE", "SOURCENAME"
+// STARTUP and SHUTDOWN have no sourcename, but need an empty "" 
 var observations =
 [
- [ "2013-01-07 19:28", "STARTUP" ],
- [ "2013-01-07 21:00", "Crab"],
- [ "2013-01-08 05:00", "Mrk 421" ],
- [ "2013-01-08 07:00", "SHUTDOWN"],
+ [ "2013-01-08 23:05", "STARTUP",  "" ],
+ [ "2013-01-08 23:13", "RATESCAN_SOURCENAME", "Dark Patch 3"],
+// [ "2013-01-08 23:32", "DATA", "Dark Patch 3"],
+ [ "2013-01-08 23:30", "DATA", "Crab" ],
+ [ "2013-01-09 04:45", "DATA",     "Mrk 421" ],
+// [ "2013-01-08 18:58", "RATESCAN_SOURCENAME", "Dark Patch 3"],
+// [ "2013-01-08 06:00", "RATESCAN_COORDINATES", 3.1415, 3.1415 ], -- not yet implemented
+ [ "2013-01-09 07:00", "SHUTDOWN", ""],
 ];
 
@@ -383,5 +389,9 @@
         throw new Error("Start time '"+utc.toUTCString()+"' in row "+i+" exceeds start time in row "+(i-1));
     //observations[i][0] = utc;
-    observations[i] = { start:utc, source:observations[i][1], toString:function(){ return this.source+" ["+this.start+"]" } };
+    //observations[i] = { start:utc, source:observations[i][1], toString:function(){ return this.source+" ["+this.start+"]" } };
+    observations[i] = { start:utc, 
+                        source:observations[i][2], 
+                        mode:observations[i][1], 
+                        toString:function(){ return this.source+" ["+this.start+"]" } };
 }
 
@@ -488,5 +498,5 @@
 
     // Check (once) if startup of shutdown is scheduled
-    switch (obs.source)
+    switch (obs.mode)
     {
     case "STARTUP":
@@ -519,6 +529,31 @@
         continue;
 
-    case "RATESCAN":
-        console.out("  RATESCAN not yet implemented.");
+    case "RATESCAN_SOURCENAME":
+        console.out("  RATESCAN  ");
+       
+        dim.send("DRIVE_CONTROL/STOP");
+        dim.wait("DRIVE_CONTROL", "Armed", 3000);
+        
+        dim.send("DRIVE_CONTROL/TRACK_SOURCE", 0, 0, obs.source);
+        dim.wait("DRIVE_CONTROL", "OnTrack", 300000);
+
+        // Checking if system is Ready for Data Taking, which is in this case 
+        // the same as Ready for RateScan.
+        //
+        // this part might be simply wrong here, since I should be able to expect
+        // the system to be able for data taking. And if not, then it is not here,
+        // to bring the system into a better state, correct?  
+        dim.wait("FEEDBACK", "CurrentControl", -100);
+        dim.wait("BIAS_CONTROL", "VoltageOn", -100);
+        dim.wait("FAD_CONTROL", "Connected", -100);
+        
+        dim.wait("RATE_SCAN","Connected", 5000);
+        dim.send("RATE_SCAN/START_THRESHOLD_SCAN", 50, 1000, -10);
+
+        // lets wait if the Ratescan really starts .. it should be started after 10sec max.        
+        dim.wait("RATE_SCAN", "InProgress", 10000);
+        dim.wait("RATE_SCAN", "Connected", 2700000);
+        console.out("Ratescan done.")        
+
         continue;
     }
