#include #include #include #include #include #include #include #include ; Function Calls Here ;~ Isitrunning(); First - Checks to see if LIMS is running, goes to main screen if it is. ;~ GoToSampleDueSheet() ;Second - Get to SampleDueSheet ;~ SaveList() ; Save Sheet for Excel - Save List From SampleDueSheet ExcelLoadAndSum() ; Load the Data From Columns One and Two and Display Both ;~ CloseCrap() AddAllTestCodes() Knownornot() Addtolistifknownfunction() Func ExcelLoadAndSum() ; Create application object and open an example workbook Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(0, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\MC_SampleDueRpt.xls") If @error Then MsgBox(0, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\Extras\_Excel1.xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf ; ***************************************************************************** ; Read the formulas of a cell range (all used cells in column A) ; ***************************************************************************** $ColumnA = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 2) $ColumnB = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("B:B"), 2) If @error Then Exit MsgBox(0, "Excel UDF: _Excel_RangeRead Example 3", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $TCArray = $ColumnB Global $SampIDArray = $ColumnA _ArrayDisplay($ColumnA) _ArrayDisplay($ColumnB) EndFunc Func CloseCrap() Send("!f!x") Sleep(200) Send("!p!c") Sleep(200) Send("^m") EndFunc Func AddAllTestCodes() Global $testcodeIC1[0] Global $testcodeIC2[0] Global $testcodeIC3[0] Global $testcodeIC5[0] _FileReadToArray(@ScriptDir & "\IC1testcodes.txt", $testcodeIC1, @CRLF) _FileReadToArray(@ScriptDir & "\IC2testcodes.txt", $testcodeIC2, @CRLF) _FileReadToArray(@ScriptDir & "\IC3testcodes.txt", $testcodeIC3, @CRLF) _FileReadToArray(@ScriptDir & "\IC5testcodes.txt", $testcodeIC5, @CRLF) Global $totaltestcodes = UBound($testcodeIC1) + UBound($testcodeIC2) + UBound($testcodeIC3) + UBound($testcodeIC5) Global $knowntestcode[0] _ArrayAdd($knowntestcode, $testcodeIC1) _ArrayAdd($knowntestcode, $testcodeIC2) _ArrayAdd($knowntestcode, $testcodeIC3) _ArrayAdd($knowntestcode, $testcodeIC5) EndFunc ;==>AddAllTestCodes Func Knownornot() For $i = 0 To UBound($TCArray) - 1 ;should write zomgnewtestcode to the unknown file, eventually this will prompt me to assign it to IC1, 2, or 3. But for now I just want to debug why the IF statement isn't working. Local $found = _ArraySearch($knowntestcode, $TCArray[$i]) If $found = -1 Then #Region ### START Koda GUI section ### Form=D:\GodModeAccount\Desktop\ArraydataClientIDHidden\ICSelectGUI.kxf $Form1 = GUICreate("Form1", 434, 146, 192, 200) $IC1 = GUICtrlCreateButton("IC 1", 24, 112, 89, 25) $IC2 = GUICtrlCreateButton("IC 2", 120, 112, 105, 25) $IC3 = GUICtrlCreateButton("IC3/4", 232, 112, 81, 25) $IC5 = GUICtrlCreateButton("IC5 or Unknown", 320, 112, 105, 25) $Label1 = GUICtrlCreateLabel("This test code was not found: Please select a IC to assign it to! " & $TCArray[$i], 8, 8, 412, 89) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form1) ExitLoop Case $IC1 FileWrite(@ScriptDir & "\IC1testcodes.txt", $TCArray[$i] & @CRLF) AddAllTestCodes() GUIDelete($Form1) ExitLoop Case $IC2 FileWrite(@ScriptDir & "\IC2testcodes.txt", $TCArray[$i] & @CRLF) AddAllTestCodes() GUIDelete($Form1) ExitLoop Case $IC3 FileWrite(@ScriptDir & "\IC3testcodes.txt", $TCArray[$i] & @CRLF) AddAllTestCodes() GUIDelete($Form1) ExitLoop Case $IC5 FileWrite(@ScriptDir & "\IC5testcodes.txt", $TCArray[$i] & @CRLF) AddAllTestCodes() GUIDelete($Form1) ExitLoop EndSwitch WEnd EndIf Next EndFunc ;==>Knownornot Func Addtolistifknownfunction() For $i = 0 To UBound($TCArray) - 1 Local $found = _ArraySearch($testcodeIC1, $TCArray[$i]) If $found <> -1 Then FileWrite(@ScriptDir & "\IC1.txt", $SampIDArray[$i] & " " & $TCArray[$i] & @CRLF) EndIf Next For $i = 0 To UBound($TCArray) - 1 Local $found = _ArraySearch($testcodeIC2, $TCArray[$i]) If $found <> -1 Then FileWrite(@ScriptDir & "\IC2.txt", $SampIDArray[$i] & " " & $TCArray[$i] & @CRLF) EndIf Next For $i = 0 To UBound($TCArray) - 1 Local $found = _ArraySearch($testcodeIC3, $TCArray[$i]) If $found <> -1 Then FileWrite(@ScriptDir & "\IC3.txt", $SampIDArray[$i] & " " & $TCArray[$i] & @CRLF) EndIf Next For $i = 0 To UBound($TCArray) - 1 Local $found = _ArraySearch($testcodeIC5, $TCArray[$i]) If $found <> -1 Then FileWrite(@ScriptDir & "\IC5.txt", $SampIDArray[$i] & " " & $TCArray[$i] & @CRLF) EndIf Next EndFunc ;==>Addtolistifknownfunction