--- /dev/null
+#!/bin/sh
+if [ -z "$1" ]
+ then
+ echo "No argument supplied"
+ exit 1
+fi
+
+. /local/blinnik/cernroot/root/bin/thisroot.sh
+cd /u/blinnik/radhard/MABS_run_analyzer/
+echo "root -l -b -q 'ChargeSpektrum.c+(\"'$1'\")'"
+root -l -b -q 'ChargeSpektrum.c+("'$1'")'
--- /dev/null
+; *** Start added by AutoIt3Wrapper ***
+#include <GUIConstantsEx.au3>
+#include <ListViewConstants.au3>
+#include <WindowsConstants.au3>
+#include <guilistview.au3>
+; *** End added by AutoIt3Wrapper ***
+#include "Functions/mysql_functions.au3"
+#AutoIt3Wrapper_Add_Constants=n
+$gui1 = GUICreate("lv+checkboxes example", 300, 500, 200, 200, BitOR($Ws_SIZEBOX, $GUI_SS_DEFAULT_GUI))
+
+Global $ListView1 = GUICtrlCreateListView("Found runs|Temperatur", 1, 0, 300, 465, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_FLATSB))
+Global $OKButton = GUICtrlCreateButton("OK",5,470,290)
+GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 190)
+GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
+
+_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_ONECLICKACTIVATE ))
+
+$click_id = GuiCtrlCreateDummy()
+$dblclick_id = GuiCtrlCreateDummy()
+GUISetState(@SW_SHOW)
+_AddLVItems()
+GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
+
+Func _AddLVItems()
+ $runcandidates = ReturnSuitRuns("Pegasus", 8, "Sr90", "Pegasus")
+ If NOT $runcandidates.EOF Then
+ With $runcandidates
+ $runparam = .Fields("runnumber").value
+ GUICtrlCreateListViewItem(.Fields("runnumber").value&"|"&.Fields("TempCooling").value, $ListView1)
+ _GUICtrlListView_SetItemChecked($ListView1,_GUICtrlListView_GetNextItem($ListView1),True)
+ EndWith
+ EndIf
+
+ $aText = StringSplit(StringStripWS(StringReplace(FileRead(@ScriptFullPath), @CR, ' '), 4), ' ')
+; For $n = 1 To 20
+; GUICtrlCreateListViewItem($aText[$n]&"|"&$n, $ListView1)
+; _GUICtrlListView_SetItemChecked($ListView1,$n-1,True)
+; Next
+
+EndFunc ;==>_AddLVItems
+
+
+GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
+
+While 1
+ $msg = GuiGetMsg()
+ Select
+ Case $msg = $GUI_EVENT_CLOSE
+ Exit
+ Case $msg = $click_id
+ ConsoleWrite('Click: id:' & $msg & @CRLF)
+ OnClick(GUICtrlRead($click_id))
+ Case $msg = $OKButton
+ ConsoleWrite('Click: id:' & $msg & @CRLF)
+ EndSelect
+WEnd
+
+Func OnClick($subitem)
+ $item = _GUICtrlListView_GetNextItem($ListView1) ; current selected
+ $curcheckstatus = _GUICtrlListView_GetItemChecked($ListView1,$item)
+ _GUICtrlListView_SetItemChecked($ListView1,$item,NOT $curcheckstatus)
+ $value = _GUICtrlListView_GetItemText($ListView1,$item,$subitem)
+ ConsoleWrite('Click: index:' & $item & ' subitem:' & $subitem & ' value:' & $value & @CRLF)
+EndFunc
+
+
+Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
+ #forceref $hWndGUI, $MsgID, $wParam
+
+ Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
+ Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
+ Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
+
+ If $wParam = $ListView1 Then
+ If $nNotifyCode = $NM_CLICK Then
+ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
+;~ $item = DllStructGetData($tInfo, "Index")
+ $subitem = DllStructGetData($tInfo, "SubItem")
+;~ OnClick($item,$subitem)
+ GUICtrlSendToDummy($click_id, $subitem)
+ EndIf
+ EndIf
+EndFunc
\ No newline at end of file
--- /dev/null
+#include <I2C_control_FSBB.au3>
+Global $Mi34_buttons[3] = ["Edit2", "TCSpinEdit5", "TEdit11"]
+
+Func Mi34_GotoMiTab()
+ GotoTab(7) ; Go to "Mi34" tab
+EndFunc ;==>Mi34_GotoMiTab
+
+Func Mi34_SelectBoard()
+ GotoTab(0) ; Go to first tab
+ ControlCommand($chipsoftware[0], "", "[TEXT:Mimosa34]", "Check")
+EndFunc ;==>Mi34_SelectBoard
+
+Func Mi34_GetVref()
+ return ControlGetText($chipsoftware[0], "", $Mi34_buttons[2])
+EndFunc ;==>Mi34_GetVref
+
+Func Mi34_SetVref($vref)
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref)
+EndFunc ;==>Mi34_SetVref
+
+Func Mi34_SetMiParameter($matrix, $vref)
+ ControlFocus($chipsoftware[0], "", $Mi34_buttons[0])
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[0], "")
+ Sleep(100)
+ ControlSend($chipsoftware[0], "", $Mi34_buttons[0], $matrix)
+ Sleep(100)
+ ;Send($matrix)
+ ;ControlCommand($chipsoftware[0], "", "[TEXT:Clamp Enabled]", "Uncheck")
+ ;ControlCommand($chipsoftware[0], "", "[TEXT:High (Default)]", "Check")
+ ControlFocus($chipsoftware[0], "", $Mi34_buttons[1])
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "")
+ Sleep(100)
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[1], "1")
+ Sleep(100)
+ ControlFocus($chipsoftware[0], "", $Mi34_buttons[2])
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], "")
+ Sleep(100)
+ ControlSetText($chipsoftware[0], "", $Mi34_buttons[2], $vref)
+ Sleep(100)
+EndFunc ;==>Mi34_SetMiParameter
--- /dev/null
+#include-once
+Global $chipsoftware[2] = ["I2C control Software for Mimosa32", "TPageControl1"]
+Global $system = "USB"
+Global $hWnd
+Global $hCounter
+$savedir = "O:\FSBB"
+Global $vref = 650 ; Initial vref, will be adjusted during runtime
+$temperaturebefore = -10000
+
+Func CheckWindowExist() ; Check if Mimosa window exists
+ If WinExists($chipsoftware[0]) = False Then
+ Run("C:\CCMOS_SCTRL\MIMOSA34\I2C_ms_gui_labo_Debug.bat", "C:\CCMOS_SCTRL\MIMOSA34\")
+ WinWait($chipsoftware[0])
+ EndIf
+ WinWait("I2C control Software for Mimosa32")
+EndFunc ;==>CheckWindowExist
+
+Func CheckIfBoardOK()
+ ControlClick($chipsoftware[0], "", "[TEXT:Inactive;CLASS:TButton]") ; Activate Polling
+ Local $i = 0
+ While(ControlGetText($chipsoftware[0], "", "TEdit6") <> "Target Board OK")
+ If($i > 20) Then
+ MsgBox(16, "Message", "Mimosa board could not be polled, please check if board is connected properly.")
+ Exit
+ EndIf
+ $i = $i + 1
+ Sleep(500)
+ WEnd
+ ControlClick($chipsoftware[0], "", "[TEXT:Active;CLASS:TButton]")
+EndFunc ;==>CheckIfBoardOK
+
+Func GotoTab($tabnum)
+ WinWait($chipsoftware[0])
+ Local $hWnd = WinGetHandle($chipsoftware[0])
+ Local $hTab = ControlGetHandle($hWnd, "", $chipsoftware[1])
+ _GUICtrlTab_SetCurFocus($hTab, $tabnum) ; Go to "$tabnum" tab
+ Sleep(100)
+EndFunc ;==>GotoTab
+
+Func GotoDebugTab()
+ GotoTab(9)
+EndFunc ;==>GotoDebugTab
+
+Func ProgramMi()
+ ControlClick($chipsoftware[0], "", "[TEXT:Prog All Analog;CLASS:TButton]") ; Program!
+ Sleep(1000)
+EndFunc ;==>ProgramMi
+
+Func GetCounter()
+ Return ControlGetText($hWnd, "", $hCounter)
+EndFunc ;==>GetCounter
+
+Func StopRun()
+ ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]")
+EndFunc
+
+Func StartRun()
+ ControlClick($hWnd, "", "[TEXT:Start Run;CLASS:TButton]")
+EndFunc
+
+Func TestSystem()
+ WinWait("Debug")
+ ControlClick("Debug", "", "[TEXT:Messages Clear]")
+ Sleep(100)
+ ControlClick("Debug", "", "[TEXT:Board Testing]")
+ Sleep(2000)
+ $i = 0
+ Do
+ $text = WinGetText("[CLASS:TDebugFrm]", "")
+ $texthex = _StringToHex($text)
+ If ($texthex == "4D657373616765730A5072696E7420426F6172647320526567730A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D302074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A426F6172642049643D312074657374207374617274696E67202E2E2E0D0A3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0D0A0D0A53746F70206163717569736974696F6E202E2E2E0D0A41445220434F554E54455220412074657374696E67202E2E2E0D0A41445220434F554E54455220412030204572726F72730D0A52414D20412074657374696E67202E2E2E0D0A52414D20412030204572726F72730D0A52414D20422074657374696E67202E2E2E0D0A52414D20422030204572726F72730D0A52414D20432074657374696E67202E2E2E0D0A52414D20432030204572726F72730D0A52414D20442074657374696E67202E2E2E0D0A52414D20442030204572726F72730D0A0A555342322042616E647769647468204D65617375726D656E740A426F6172642054657374696E670A536F66747761726520496E697469616C697A6174696F6E0A4D6573736167657320436C6561720A") Then
+ ExitLoop
+ EndIf
+ Sleep(500)
+ $i = $i + 1
+ If ($i > 20) Then
+ RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.")
+ ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."')
+ MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.")
+ Return 1
+ EndIf
+ Until 0
+ If StringRegExp($text, "[1-9]+ Errors") Then ; double check, will remove it later
+ RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.")
+ ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."')
+ MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.")
+ Return 1
+ EndIf
+ WinClose("Debug")
+ WinWaitClose("Debug", 1000)
+ Return 0
+EndFunc
+
+Func GetAverage()
+ Return ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]")
+EndFunc
--- /dev/null
+#include-once
+Global $system = "USB"
+Global $hWnd
+Global $hCounter
+Global $vref = -1 ; Initial vref, will be adjusted during runtime
+$temperaturebefore = -10000
+
+Func Mi19_SelectBoard()
+
+EndFunc ;==>Mi34_SelectBoard
+
+Func Mi19_SetMiParameter($matrix, $vref)
+ Sleep(1000)
+ $savedir = "F:\currentrun" ; overwrite store path set in other Mimosa files read in by include
+ $storedir = "O:\Mi19"
+EndFunc ;==>Mi34_SetMiParameter
+
+Func Mi19_TestSystem()
+ WinWait("Debug")
+ ControlClick("Debug", "", "[TEXT:Messages Clear]")
+ Sleep(100)
+ ControlClick("Debug", "", "[TEXT:Board Testing]")
+ Sleep(2000)
+ $i = 0
+ Do
+ $text = WinGetText("[CLASS:TDebugFrm]", "")
+ $texthex = _StringToHex($text)
+ ConsoleWrite($texthex)
+ If (StringInStr($text, "RAM D 0 Errors") > 0 ) Then
+ ExitLoop
+ EndIf
+ Sleep(500)
+ $i = $i + 1
+ If ($i > 20) Then
+ RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.")
+ ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."')
+ MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.")
+ Return 1
+ EndIf
+ Until 0
+ If StringRegExp($text, "[1-9]+ Errors") Then ; double check, will remove it later
+ RefreshGUISendNtfct("USB Boards could be not OK! Please turn them on and off.")
+ ;Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUISendNtfct.au3" "' & $system & '" "' & $completelog & '" "USB Boards could be not OK! Please turn them on and off."')
+ MsgBox(16, "Message", "USB Boards could be not OK! Please check the Debug output.")
+ Return 1
+ EndIf
+ WinClose("Debug")
+ WinWaitClose("Debug", 1000)
+ Return 0
+EndFunc
+
+Func Mi19_GetVref()
+
+EndFunc ;==>Mi19_GetVref
+
+Func Mi19_SetVref($vref)
+
+EndFunc ;==>Mi19_SetVref
--- /dev/null
+; *** Start added by AutoIt3Wrapper ***
+#include <GUIConstantsEx.au3>
+#include <ListViewConstants.au3>
+#include <WindowsConstants.au3>
+#include <guilistview.au3>
+; *** End added by AutoIt3Wrapper ***
+#include "mysql_functions.au3"
+#AutoIt3Wrapper_Add_Constants=n
+$gui1 = GUICreate("lv+checkboxes example", 300, 500, 200, 200, BitOR($Ws_SIZEBOX, $GUI_SS_DEFAULT_GUI))
+
+Global $ListView1 = GUICtrlCreateListView("runnumber|temperature|comment", 1, 0, 300, 465, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_FLATSB))
+Global $OKButton = GUICtrlCreateButton("OK",5,470,290)
+GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 190)
+GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
+
+_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_ONECLICKACTIVATE ))
+
+$click_id = GuiCtrlCreateDummy()
+$dblclick_id = GuiCtrlCreateDummy()
+GUISetState(@SW_SHOW)
+_AddLVItems()
+GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
+
+Func _AddLVItems()
+ $runcandidatesArr = ReturnSuitRuns("Pegasus", 8, "Sr90", "Pegasus")
+ If IsArray($runcandidatesArr) Then
+ ConsoleWrite("Is Array!")
+ EndIf
+ If IsArray($runcandidatesArr) Then
+ ConsoleWrite("inside!" & @CRLF)
+ For $i = 0 to Ubound($runcandidatesArr, 1) - 1
+ ;For $j = 0 To UBound($runcandidatesArr, 2) - 1
+ GUICtrlCreateListViewItem($runcandidatesArr[$i][0]&"|"&$runcandidatesArr[$i][1]&"|"&$runcandidatesArr[$i][2], $ListView1)
+ _GUICtrlListView_SetItemChecked($ListView1,_GUICtrlListView_GetNextItem($ListView1),True)
+ ;Next
+ Next
+ EndIf
+
+ ;If NOT $runcandidates.EOF Then
+ ; With $runcandidates
+ ; $runparam = .Fields("runnumber").value
+ ; GUICtrlCreateListViewItem(.Fields("runnumber").value&"|"&.Fields("TempCooling").value, $ListView1)
+ ; _GUICtrlListView_SetItemChecked($ListView1,_GUICtrlListView_GetNextItem($ListView1),True)
+ ; EndWith
+ ;EndIf
+
+; For $n = 1 To 20
+; GUICtrlCreateListViewItem($aText[$n]&"|"&$n, $ListView1)
+; _GUICtrlListView_SetItemChecked($ListView1,$n-1,True)
+; Next
+
+EndFunc ;==>_AddLVItems
+
+
+GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
+
+While 1
+ $msg = GuiGetMsg()
+ Select
+ Case $msg = $GUI_EVENT_CLOSE
+ Exit
+ Case $msg = $click_id
+ ConsoleWrite('Click: id:' & $msg & @CRLF)
+ OnClick(GUICtrlRead($click_id))
+ Case $msg = $OKButton
+ ConsoleWrite('Click: id:' & $msg & @CRLF)
+ EndSelect
+WEnd
+
+Func OnClick($subitem)
+ $item = _GUICtrlListView_GetNextItem($ListView1) ; current selected
+ $curcheckstatus = _GUICtrlListView_GetItemChecked($ListView1,$item)
+ _GUICtrlListView_SetItemChecked($ListView1,$item,NOT $curcheckstatus)
+ $value = _GUICtrlListView_GetItemText($ListView1,$item,$subitem)
+ ConsoleWrite('Click: index:' & $item & ' subitem:' & $subitem & ' value:' & $value & @CRLF)
+EndFunc
+
+
+Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
+ #forceref $hWndGUI, $MsgID, $wParam
+
+ Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
+ Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
+ Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
+
+ If $wParam = $ListView1 Then
+ If $nNotifyCode = $NM_CLICK Then
+ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
+;~ $item = DllStructGetData($tInfo, "Index")
+ $subitem = DllStructGetData($tInfo, "SubItem")
+;~ OnClick($item,$subitem)
+ GUICtrlSendToDummy($click_id, $subitem)
+ EndIf
+ EndIf
+EndFunc
\ No newline at end of file
--- /dev/null
+;
+; AutoIt Version: 3.0
+; Language: English
+; Platform: Win9x/NT
+; Author: Benny Linnik (b.linnik@gsi.de)
+;
+; Script Function:
+; Automatically runs the USB or PXI system with data gathered from an Excel sheet
+$configfile = @ScriptDir & "\config_USB.ini"
+#include "Functions\Header.au3"
+#include "Chips\Mimosa29.au3"
+;#include "Chips\Mimosa32.au3"
+;#include "Chips\Mimosa32Ter.au3"
+;#include "Chips\Mimosa34.au3"
+#include "Chips\FSBB.au3"
+#include "Functions\SetChipClock.au3"
+#include "Functions\CommonFunctions.au3"
+#include "Functions\Checkdata.au3"
+Global $vref = 650 ; Initial vref, will be adjusted during runtime
+
+;create virtual functions
+Func GotoMiTab()
+ Call($chipversion & "_GotoMiTab")
+EndFunc ;==>GotoMiTab
+Func GetVref()
+ Return Call($chipversion & "_GetVref")
+EndFunc ;==>GetVref
+Func SetVref($vref)
+ Call($chipversion & "_SetVref", $vref)
+EndFunc ;==>SetVref
+Func SetMiParameter($matrix, $vref)
+ Call($chipversion & "_SetMiParameter", $matrix, $vref)
+EndFunc ;==>SetMiParameter
+Func SelectBoard()
+ Call($chipversion & "_SelectBoard")
+EndFunc ;==>SelectBoard
+Func _CheckWindowExist() ; Check if Mimosa window exists
+ If $chipversion <> "Mi29" Then
+ CheckWindowExist()
+ EndIf
+EndFunc ;==>_CheckWindowExist
+Func _CheckIfBoardOK()
+ If $chipversion <> "Mi29" Then
+ CheckIfBoardOK()
+ EndIf
+EndFunc ;==>_CheckIfBoardOK
+Func _GotoTab($tabnum)
+ If $chipversion <> "Mi29" Then
+ GotoTab($tabnum)
+ EndIf
+EndFunc ;==>_GotoTab
+Func _GotoDebugTab()
+ If $chipversion <> "Mi29" Then
+ GotoDebugTab()
+ EndIf
+EndFunc ;==>_GotoDebugTab
+Func _ProgramMi()
+ If $chipversion <> "Mi29" Then
+ ProgramMi()
+ EndIf
+EndFunc ;==>_ProgramMi
+Func _TestSystem()
+ If $chipversion <> "Mi29" Then
+ TestSystem()
+ Else ; mimosa 29 ausnahme
+ Call($chipversion & "_TestSystem")
+ EndIf
+EndFunc ;==>_TestSystem
+Func _GetAverage($hWnd)
+ If $chipversion <> "Mi29" Then
+ Return GetAverage()
+ Else ; mimosa 29 ausnahme
+ Return Call($chipversion & "_GetAverage", $hWnd)
+ EndIf
+EndFunc ;==>_GetAverage
+
+
+If (Not @error) Then ; Check again if everything went well
+ $totalruns = ReturnNumSuitRuns($chipversion, $chipinstalled, $radSource, "USB")
+ If $totalruns > 0 Then ; Check if we retrieved any data
+ Local $answer = MsgBox(4, "Total runs", "Number of suitable runs found at the moment: " & $totalruns)
+ If $answer = 7 Then
+ Exit
+ EndIf
+ RefreshGUISendNtfct("Starting with " & $totalruns & " runs.")
+ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ If ProcessExists("daq.exe") = True Then
+ ProcessClose("daq.exe")
+ ProcessWaitClose("daq.exe")
+ EndIf
+ If ProcessExists("i2c_ms_gui.exe") = True Then
+ ProcessClose("i2c_ms_gui.exe")
+ ProcessWaitClose("i2c_ms_gui.exe")
+ EndIf
+ Local $sTitle = "CMOS USB DAQ V3.5.10"
+ Run("C:\ccmos_daq\V3.5.10_FSBB\daq_v3.5.10B.bat", "C:\ccmos_daq\V3.5.10_FSBB\")
+ If _TestSystem() Then Exit
+ WinWait($sTitle)
+ $hWnd = WinGetHandle($sTitle)
+ $hTab = ControlGetHandle($hWnd, "", "TPageControl1")
+ $hCounter = ControlGetHandle($hWnd, "", "TEdit35")
+ $starttimetotal = _NowCalc()
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radSource, "USB")
+ While Not $suitrun[0] = "" ; Do runs, until no new run found
+ RefreshGUISendNtfct("Starting run: " & $suitrun[4]&" with Temperature:"& $suitrun[1]&"°C ")
+ #include "Functions\ReadAndSaveSQLParameters.au3"
+ #include "Functions\WaitForTemperature.au3"
+ ;_CheckWindowExist()
+ ;SelectBoard()
+ ;_CheckIfBoardOK()
+ ;ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check")
+ ;If ($clock <> "100") Then
+ ; SetChipClock($clock)
+ ; ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Extern]", "Check")
+ ;EndIf
+ ;GotoMiTab()
+ ;SetMiParameter($matrix, $vref)
+ ;ProgramMi()
+ _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+ Sleep(200)
+ ;$savedir = ControlGetText($hWnd, "", "TEdit24") ; get directorys to save file to
+ ;GUICtrlSetState($hWnd, "", "TCheckBox6", "")
+ ControlSetText($hWnd, "", "TEdit29", "")
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit29")
+ ControlSend($hWnd, "", "TEdit29", $savedir)
+ Sleep(100)
+ ControlSetText($hWnd, "", "TEdit28", "")
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit28")
+ ControlSend($hWnd, "", "TEdit28", $runnumber)
+ Sleep(100)
+ ControlSetText($hWnd, "", "TEdit27", "")
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit27")
+ ControlSend($hWnd, "", "TEdit27", $events)
+ Sleep(100)
+ ControlFocus($hWnd, "", "TEdit28")
+ Sleep(1000)
+
+ $starttime = _NowCalc()
+ StartRun()
+ Sleep(1000)
+ If (WinExists("Avertissement")) Then
+ RefreshGUISendNtfct("Skipped run " & $runnumber & " could overwrite data.")
+ _ArrayAdd($skippedruns, $runnumber)
+ $comment = "Skipped: Could overwrite data."
+ #include "Functions/SaveToSQL.au3"
+ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', could overwrite data!'')"')
+ ControlClick("Avertissement", "", "TButton1")
+ ContinueLoop
+ EndIf
+ $avg = _GetAverage($hWnd)
+
+ Sleep(200)
+ $j = 0
+;~ If ($avg > 2300 Or $avg < 1700) Then
+;~ Do
+;~ ControlClick($hWnd, "", "[TEXT:Stop Run;CLASS:TButton]")
+;~ $vref = GetVref()
+;~ $diff = $avg - 2000
+;~ Select
+;~ Case Abs($diff) > 600
+;~ $vref = $vref + SGN($diff) * 100
+;~ Case Else
+;~ $vref = $vref + SGN($diff) * 50
+;~ EndSelect
+;~ If ($vref > 1000 Or $vref < 300) Then
+;~ StopRun()
+;~ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Frequency: " & $clock)
+;~ _ArrayAdd($skippedruns, $runnumber)
+;~ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
+;~ FileDelete($savedir & "/" & $runnumber & "/*")
+;~ $vref = 650
+;~ ContinueLoop 2
+;~ EndIf
+;~ SetVref($vref)
+;~ _ProgramMi()
+;~ WinWait($hWnd)
+;~ ;_GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+;~ StartRun()
+;~ WinWait("Avertissement")
+;~ ControlClick("Avertissement", "", "TButton2")
+;~ Sleep(1000)
+;~ $avg = ControlGetText($hWnd, "", "[TEXT:DispAvg;CLASS:TEdit]")
+;~ Sleep(100)
+;~ $j = $j + 1
+;~ If ($j > 10) Then
+;~ StopRun()
+;~ RefreshGUISendNtfct("Skipped run " & $runnumber & ", vref value could not be set properly. Clock: " & $clock & " Mhz")
+;~ _ArrayAdd($skippedruns, $runnumber)
+;~ Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(48, ''Warning'', ''Skipped run ' & $runnumber & ', vref value needs to be too low (<300) or too high (>1000), please check manually!'')"')
+;~ FileDelete($savedir & "/" & $runnumber & "/*")
+;~ $vref = 650
+;~ ContinueLoop 2
+;~ EndIf
+;~ Until ($avg < 2300 And $avg > 1700)
+;~ EndIf
+ #include "Functions\Watchrun.au3"
+ _GUICtrlTab_SetCurFocus($hTab, 2) ; Go to "Run parameter" tab
+ Sleep(100)
+ StopRun()
+ #include "Functions\SaveToSQL.au3"
+ $totalrealruns = $totalrealruns + 1
+ $completelog &= _NowCalc() & " Completed run " & $runnumber & ", " & $percentoverall & "% (" & $totalrealruns & "/" & $totalruns & ")" & @CRLF
+ Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\Functions\RefreshGUI.au3" "' & $completelog & '"')
+ $suitrun = ReturnSuitRun($chipversion, $chipinstalled, $radSource, "USB")
+ ConsoleWrite($suitrun[0])
+ WEnd
+ ControlCommand("I2C control Software for Mimosa32", "", "[TEXT:Intern]", "Check")
+ ShellExecuteWait("C:\Programme\PuTTY\plink.exe", "-ssh cerberus /home/maps/bin/vxi11_cmd 192.168.10.152 'OUTPut1:STATe Off'", "", "", @SW_HIDE)
+ #include "Functions\PrintSucessMessage.au3"
+ Else
+ MsgBox(16, "SQL Data Test", "No suitable runs found")
+ EndIf
+Else
+ MsgBox(16, "Server fail", "Error: Could not open connection to mySQL server.")
+EndIf
+Func SGN($i)
+ Return ($i > 0) - ($i < 0)
+EndFunc ;==>SGN
+Func CheckValues($vref, $matrix, $runnumber, $events, $clock)
+ Return 0
+EndFunc ;==>CheckValues
--- /dev/null
+[experimental setup]
+ChipVersion = Pegasus
+ChipInstalled = 4
+RadSource = Fe55
+[various]
+Notify = 3
+NotifyCustom = (Optional)
--- /dev/null
+[experimental setup]
+ChipVersion = Mi19
+ChipInstalled = 10
+RadSource = Fe55
+[various]
+Notify = 1
+NotifyCustom = aliyazgili@yahoo.de