From 400328e30a9f961d8c74e6dd82a8dfcbf371a1b6 Mon Sep 17 00:00:00 2001
From: Carmelo Pellegrino <carmelo.pellegrino@gmail.com>
Date: Thu, 14 May 2015 15:47:18 +0200
Subject: [PATCH] developing all the needed points; control of the DM
 implemented

---
 rsselector.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/rsselector.sh b/rsselector.sh
index fbf5b40..b58326b 100644
--- a/rsselector.sh
+++ b/rsselector.sh
@@ -19,10 +19,53 @@ function createList() {
   echo ${LIST[*]}
 }
 
-selected=`zenity --title "Run Setup Selector" \
+function dm_driver() {
+  echo "set session target = run"
+
+  sleep $1
+
+  echo exit
+  echo y
+}
+
+# Ask for the run setup
+
+rs_file=`zenity --title "Run Setup Selector" \
                  --list \
                  --text "Select one of the following Run Setups:" \
                  --radiolist \
                  --column="Selection" \
                  --column="Run Setup file" \
                  $(createList ${folder})`
+
+if [ -z "${rs_file}" ]; then
+  zenity --error  --text="No Run Setup file selectet, aborting"
+  exit -1
+fi
+
+# Peak the run number
+
+run_number=`get_run_number`
+
+# Copy selected run setup file, changing the run number
+
+# Ask for run duration
+
+run_duration=`zenity --title "Run duration" \
+                     --list \
+                     --text "Select one of the following duration:" \
+                     --radiolist \
+                     --column="Selection" \
+                     --column="Minutes" \
+                     FALSE 5 TRUE 10 FALSE 20`
+
+# Launch the DM
+dm_driver ${run_duration} | mono DetectorControl.exe --control --reset &
+
+# Launch the DAQ
+DAQ.sh
+
+# Point the browser to the correct address, if required
+zenity --question \
+       --text="Would you like to open the DetectorManager GUI?" \
+       --cancel-label="No, thanks" && firefox http://localhost:1301/
-- 
GitLab