Jump to content

alankam58

Active Members
  • Posts

    25
  • Joined

  • Last visited

About alankam58

  • Birthday 11/23/1982

Profile Information

  • Location
    Dongguan, China
  • Interests
    windows GUI scripting

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

alankam58's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. #include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <StaticConstants.au3> #include <GuiToolbar.au3> #include <ColorConstantS.au3> #include <ButtonConstants.au3> #include <FontConstants.au3> #include <GuiTab.au3> #include <Debug.au3> #include <ListViewConstants.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <File.au3> #include <GuiToolTip.au3> #include <WinAPIConstants.au3> #include <GuiListView.au3> #include <ColorConstants.au3> #include <StructureConstants.au3> #include <WinAPI.au3> #include <StringConstants.au3> Opt("GUICloseOnESC", 0) Opt("TrayIconHide", 1) ;~ Opt("GUIOnEventMode", 1) #Region -->> Global Control Variable Global $hGUI, $hGUI_2, $hBarcode, $aProductData, $aTestItemData, $hTITable, $aOriTestItemData Global $GetProgramPath Global $FinalResult = 1 ; Set final test result 1=Passed; 0=Failed Global $StopTest = 0 Global $ScriptChange = 0 ; Set default test script no change Global $EditVBsPID, $VBsFileBefore, $VBsFileAfter Global $aBarcodeSN[2][2] $aBarcodeSN[0][0] = "Barcode" $aBarcodeSN[0][1] = "Result" $aBarcodeSN[1][0] = "DummyCode" $aBarcodeSN[1][1] = "Passed" ;Use for Barcode Scanning GUI Global $FF_ESC_Exit = 0 Global $ibOK Global $ScriptEditting = @ScriptDir & "\Notepad++\notepad++.exe" Global $EditPID Global $StartTestTime, $EndTestTime ;-->> GUI Size Setting Local $g_Main[2] = [1024, 768] ;Restore/Standard Win Size ;~ Local $sFont = "Courier New" #EndRegion #Region -->> Menu Control Variable Dim $MenuFile[7] Dim $MenuEdit[8] Dim $MenuRun[6] Dim $MenuOpt[8] Dim $MenuHelp[2] #EndRegion #Region -->> Toolbar Button Dim $ToolsBtn[15] #EndRegion #Region -->> Program ListView Dim $ProgTab[3] Global $ListViewTbl Global Enum $idSubInsert=1000, $idSubDelete, $idSubClear, $idSubCut, $idSubCopy, $idSubPaste Global $aGetData[1] Global $lvParam, $hFont, $defColLV = 0x000000, $defBkColLV = 0xFFFFFF Global $hListView Dim $aLV1[1][20][5] Global Const $INDEXSHIFT = 9999 ; need to avoid complications with other (lower) Control-ID Global $ahWndSets[1][2] #EndRegion #Region -->> Status Edit Local $StatusEdit #EndRegion #Region -->> Status & Date/Time Global $Status[3] #EndRegion #Region -->> GUI Tab Dim $GUITab[4] ; General Information Tab Dim $InfoTab[21] Global $ProgramInfo = 0 ; UUT/Barcode Input Box Local $SNNo = 10 ;Dummy number of Barcode DIM $iBarcode[$SNNo] ;_DebugArrayDisplay($rUUTNo) ; Clear all SN Local $btnSNClear ; Lable Font and Color ;~ $FontColor = 0xFFFFFF ;~ $GroupColor = 0xFFFFFF #EndRegion #Region -->> Icon Path Dim $ToolsIco[27] ;Icon file path $ToolsIco[1] = @ScriptDir&"\Image\ToolsBar\New.ico" $ToolsIco[2] = @ScriptDir&"\Image\ToolsBar\Open.ico" $ToolsIco[3] = @ScriptDir&"\Image\ToolsBar\Save.ico" $ToolsIco[4] = @ScriptDir&"\Image\ToolsBar\Close.ico" $ToolsIco[5] = @ScriptDir&"\Image\ToolsBar\EditVBs.ico" $ToolsIco[6] = @ScriptDir&"\Image\ToolsBar\Cut.ico" $ToolsIco[7] = @ScriptDir&"\Image\ToolsBar\Copy.ico" $ToolsIco[8] = @ScriptDir&"\Image\ToolsBar\Paste.ico" $ToolsIco[9] = @ScriptDir&"\Image\ToolsBar\Delete.ico" $ToolsIco[10] = @ScriptDir&"\Image\ToolsBar\Run.ico" $ToolsIco[11] = @ScriptDir&"\Image\ToolsBar\Step.ico" $ToolsIco[12] = @ScriptDir&"\Image\ToolsBar\Stop.ico" $ToolsIco[13] = @ScriptDir&"\Image\ToolsBar\Exit.ico" $ToolsIco[14] = @ScriptDir&"\Image\ToolsBar\New_g.ico" $ToolsIco[15] = @ScriptDir&"\Image\ToolsBar\Open_g.ico" $ToolsIco[16] = @ScriptDir&"\Image\ToolsBar\Save_g.ico" $ToolsIco[17] = @ScriptDir&"\Image\ToolsBar\Close_g.ico" $ToolsIco[18] = @ScriptDir&"\Image\ToolsBar\EditVBs_g.ico" $ToolsIco[19] = @ScriptDir&"\Image\ToolsBar\Cut_g.ico" $ToolsIco[20] = @ScriptDir&"\Image\ToolsBar\Copy_g.ico" $ToolsIco[21] = @ScriptDir&"\Image\ToolsBar\Paste_g.ico" $ToolsIco[22] = @ScriptDir&"\Image\ToolsBar\Delete_g.ico" $ToolsIco[23] = @ScriptDir&"\Image\ToolsBar\Run_g.ico" $ToolsIco[24] = @ScriptDir&"\Image\ToolsBar\Step_g.ico" $ToolsIco[25] = @ScriptDir&"\Image\ToolsBar\Stop_g.ico" $ToolsIco[26] = @ScriptDir&"\Image\ToolsBar\Exit_g.ico" #EndRegion #Region -->> Function & Sub Variable Global $aFuncSubList, $hAperture, $rFuncSubCombo, $rItemCombo Global $iFuncSub[12] Global $iParam[26][3] #EndRegion #Region -->> Flexflow Variable Global $aFFTestData[1][15][1] = [[["GROUP NAME"], ["DATATYPE"], ["MODULETIME/TOTALTIME"], ["TIMESTAMP"], ["Group STATUS"], ["TEST NAME"], ["DESCRIPTION"], ["UNIT"], ["VALUE"], ["HILIM"], ["LOLIM"], ["STATUS"], ["RULE"], ["TARGET"], ["DATATYPE"]]] ;~ _DebugArrayDisplay($aFFTestData, "$aFFTestData") #EndRegion #Region -->> User include - need to be add after public variable #include "_PublicScript.au3" #include "Login.au3" #include "NewProgram.au3" #include "LoadOldProgram.au3" #include "LoadProgram.au3" #include "_BarcodeInput.au3" #include "xmlCreator.au3" #include "_OptionMenu.au3" #EndRegion $FontColor = 0x000000 $GroupColor = $Blue ;Hotkey HotKeySet("{ESC}", "_CloseBarcode") HotKeySet("{F5}", "_F5Run") HotKeySet("{F7}", "_F7Stop") $rLogin = _Login() Global $flexATSUser = $rLogin[0][0] Global $flexATSAccessRight = $rLogin[0][2] If StringCompare($flexATSUser, -1) <> 0 Then MainPage() Else Exit EndIf Func MainPage() Local $hFile, $hEdit, $hHelp, $hMain Dim $aWinSize $hGUI = GUICreate($GUITitle, $g_Main[0], $g_Main[1], -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU )) ;GUISetBkColor($LightBlue, $hGUI) ;GUISetBkColor($GUI_BKCOLOR_TRANSPARENT , $hGUI) ;GUICtrlCreatePic($BackgroundImage, 0, 0, $g_Main[0], $g_Main[1]) ;GUICtrlSetState(-1, $GUI_DISABLE) ;GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUISetIcon($TitleIcon) ;GUISetState(@SW_MAXIMIZE) #Region -->> GUI Menu ; Create File menu $MenuFile[0] = GUICtrlCreateMenu("&File") $MenuFile[1] = GUICtrlCreateMenuItem("&New", $MenuFile[0]) $MenuFile[2] = GUICtrlCreateMenuItem("Open/Load", $MenuFile[0]) GUICtrlSetState(-1, $GUI_DEFBUTTON) ;$MenuFile[3] = GUICtrlCreateMenuItem("&Close", $MenuFile[0]) $MenuFile[4] = GUICtrlCreateMenuItem("&Save", $MenuFile[0]) $MenuFile[5] = GUICtrlCreateMenuItem("Save As", $MenuFile[0]) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("", $MenuFile[0]) $MenuFile[6] = GUICtrlCreateMenuItem("E&xit", $MenuFile[0]) ;Local $idRecentfilesmenu = GUICtrlCreateMenu("Recent Files", $idFilemenu, 1) ; Create Edit menu $MenuEdit[0] = GUICtrlCreateMenu("&Edit") $MenuEdit[1] = GUICtrlCreateMenuItem("&Undo", $MenuEdit[0]) GUICtrlSetState(-1, $GUI_DISABLE) $MenuEdit[2] = GUICtrlCreateMenuItem("&Redo", $MenuEdit[0]) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("", $MenuEdit[0]) $MenuEdit[3] = GUICtrlCreateMenuItem("&Cut", $MenuEdit[0]) $MenuEdit[4] = GUICtrlCreateMenuItem("C&opy", $MenuEdit[0]) $MenuEdit[5] = GUICtrlCreateMenuItem("&Paste", $MenuEdit[0]) GUICtrlCreateMenuItem("", $MenuEdit[0]) $MenuEdit[6] = GUICtrlCreateMenuItem("&Insert", $MenuEdit[0]) $MenuEdit[7] = GUICtrlCreateMenuItem("&Delete", $MenuEdit[0]) ; Create Run menu $MenuRun[0] = GUICtrlCreateMenu("&Run") $MenuRun[1] = GUICtrlCreateMenuItem("Execute Test", $MenuRun[0]) $MenuRun[2] = GUICtrlCreateMenuItem("Single Test", $MenuRun[0]) $MenuRun[3] = GUICtrlCreateMenuItem("Stop", $MenuRun[0]) GUICtrlCreateMenuItem("", $MenuRun[0]) $MenuRun[4] = GUICtrlCreateMenuItem("Debug Mode", $MenuRun[0]) If $DebugMode = 1 Then GUICtrlSetState($MenuRun[4], $GUI_CHECKED) ; Create Option menu $MenuOpt[0] = GUICtrlCreateMenu("&Option") $MenuOpt[1] = GUICtrlCreateMenuItem("System Configuration", $MenuOpt[0]) GUICtrlCreateMenuItem("", $MenuOpt[0]) $MenuOpt[2] = GUICtrlCreateMenuItem("Extended Code", $MenuOpt[0]) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("", $MenuOpt[0]) $MenuOpt[3] = GUICtrlCreateMenuItem("Convert Old Program", $MenuOpt[0]) ; Create Help menu $MenuHelp[0] = GUICtrlCreateMenu("&Help") $MenuHelp[1] = GUICtrlCreateMenuItem("&About", $MenuHelp[0]) #EndRegion --->> GUI Menu #Region --->>> Toolbar Button GUICtrlCreateGraphic(2, 9, 2, 43, BitOR($SS_NOTIFY,$SS_SUNKEN)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) $ToolsBtn[1] = GUICtrlCreateIcon($ToolsIco[1], "New", 6, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Create New") $ToolsBtn[2] = GUICtrlCreateIcon($ToolsIco[2], "Open", 58, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Open/Load Program") $ToolsBtn[3] = GUICtrlCreateIcon($ToolsIco[3], "Save", 110, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Save") $ToolsBtn[4] = GUICtrlCreateIcon($ToolsIco[4], "Cancel", 162, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Cancel/Restore Changes") ;----------- Saperator GUICtrlCreateGraphic(214, 9, 2, 43, BitOR($SS_NOTIFY,$SS_SUNKEN)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) $ToolsBtn[5] = GUICtrlCreateIcon($ToolsIco[5], "EditVBs", 218, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Edit Test Program") ;----------- Saperator GUICtrlCreateGraphic(270, 9, 2, 43, BitOR($SS_NOTIFY,$SS_SUNKEN)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) $ToolsBtn[6] = GUICtrlCreateIcon($ToolsIco[6], "Cut", 274, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Cut Row") $ToolsBtn[7] = GUICtrlCreateIcon($ToolsIco[7], "Copy", 326, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Copy Row") $ToolsBtn[8] = GUICtrlCreateIcon($ToolsIco[8], "Paste", 378, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Paste Row") $ToolsBtn[9] = GUICtrlCreateIcon($ToolsIco[9], "Delete", 430, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Delete Row") ;----------- Saperator GUICtrlCreateGraphic(482, 9, 2, 43, BitOR($SS_NOTIFY,$SS_SUNKEN)) ;----------- GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) $ToolsBtn[10] = GUICtrlCreateIcon($ToolsIco[10], "Run", 486, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Run Test") $ToolsBtn[11] = GUICtrlCreateIcon($ToolsIco[11], "Step", 538, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Step Test") $ToolsBtn[12] = GUICtrlCreateIcon($ToolsIco[12], "Stop", 590, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Stop Test") ;----------- Saperator GUICtrlCreateGraphic(642, 9, 2, 43, BitOR($SS_NOTIFY,$SS_SUNKEN)) ;----------- GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) $ToolsBtn[13] = GUICtrlCreateIcon($ToolsIco[13], "Exit", 646, 5, 50, 50, BitOR($SS_CENTERIMAGE,$SS_NOTIFY)) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKSIZE) GUICtrlSetTip(-1, "Exit Program") #EndRegion --->>> Toolbar Button #Region --->> Status Edit ;~ $StatusEdit = GUICtrlCreateEdit("Status Edit:", 345, 510, 670, 210, $ES_AUTOVSCROLL + $ES_AUTOHSCROLL) $StatusEdit = GUICtrlCreateLabel("flexATS", 345, 510, 670, 210, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT) GUICtrlSetFont(-1, 90, $FW_EXTRABOLD, $GUI_FONTNORMAL, "Arial Rounded MT Bold") GUICtrlSetColor(-1, $flexBlue) #EndRegion --->> Status Edit #Region -->> Status & Date/Time ; Create Status control $Status[1] = GUICtrlCreateLabel("flexATS Status Bar...", 2, 722, 862, 25,BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 9, $FW_MEDIUM, 0, $sFont) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT) GUICtrlSetColor(-1, $FontColor) ;~ GUICtrlSetBkColor(-1, $Blue) ; Create date & time display $Status[2] = GUICtrlCreateLabel("", 866, 722, 150, 25,BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 9, $FW_MEDIUM, 0, $sFont) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKRIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) ;~ GUICtrlSetBkColor(-1, $Blue) GUICtrlSetData($Status[2],_NowCalc()) #EndRegion -->> Status & Date/Time #Region -->> Test Item ListView $ListViewTbl = GUICtrlCreateListView("", 345, 86, 670, 420, BitOR($LVS_DEFAULT, $WS_BORDER, $LVS_REPORT)) GUICtrlSetResizing($ListViewTbl, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT) _GUICtrlListView_SetExtendedListViewStyle($ListViewTbl, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES));, $LVS_EX_TRANSPARENTBKGND)) $hListView = GUICtrlGetHandle($ListViewTbl) _GUICtrlListView_AddColumn($ListViewTbl, "No.", 50, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Execute Function\Sub", 200, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Test Items Name", 220, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Lower Limit", 120, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Upper Limit", 120, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Unit", 50, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Actual", 80, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Test Result", 80, 2) _GUICtrlListView_AddColumn($ListViewTbl, "Retry", 50, 2) ;~ _GUICtrlListView_AddColumn($ListViewTbl, "Fail goto", 70, 2) Global $ItemInsert = GUICtrlCreateDummy() Global $ItemDel = GUICtrlCreateDummy() Global $ItemClear = GUICtrlCreateDummy() Global $ItemCut = GUICtrlCreateDummy() Global $ItemCopy = GUICtrlCreateDummy() Global $ItemPaste = GUICtrlCreateDummy() #EndRegion #Region --->> GUI Info Tab $TopDown = 70 $GUITab[0] = GUICtrlCreateTab(2, 66, 240, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;~ GUICtrlSetBkColor($GUITab[0], 0xDDEBF7) #Region --->>> Information Tab $GUITab[1] = GUICtrlCreateTabitem("General Info") GUICtrlCreateGroup("Product Information", 5, 25+$TopDown, 330, 150) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Product Information", 5, 30+$TopDown, 326, 140, $FontColor, $GroupColor) GUICtrlCreateLabel("Model Name:", 8, 50+$TopDown, 100, 25, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[1] = GUICtrlCreateInput("", 110, 47+$TopDown, 218, 20, BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Model Descp.:", 8, 81+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[2] = GUICtrlCreateInput("", 110, 78+$TopDown, 218, 20, BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Model P/N:", 8, 112+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[3] = GUICtrlCreateInput("", 110, 109+$TopDown, 218, 20, BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Model Revision:", 8, 143+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[4] = GUICtrlCreateInput("", 110, 140+$TopDown, 218, 20, BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateGroup("Test Yield", 5, 185+$TopDown, 330, 150) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Test Yield Information", 5, 190+$TopDown, 326, 140, $FontColor, $GroupColor) GUICtrlCreateLabel("Total Tested:", 8, 210+$TopDown, 100, 25, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[14] = GUICtrlCreateLabel("0", 110, 207+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) ;~ GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Passed Units:", 8, 241+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[15] = GUICtrlCreateLabel("0", 110, 238+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Failed Units:", 8, 272+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[16] = GUICtrlCreateLabel("0", 110, 269+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("First Pass Yield:", 8, 303+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[17] = GUICtrlCreateLabel("0.00%", 110, 300+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetBkColor(-1, $LightRed) GUICtrlCreateGroup("Test Time", 5, 345+$TopDown, 330, 120) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Test Time Infomartion", 5, 350+$TopDown, 326, 110, $FontColor, $GroupColor) GUICtrlCreateLabel("Start Time:", 8, 370+$TopDown, 100, 25, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[18] = GUICtrlCreateLabel("", 110, 367+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("End Time:", 8, 401+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[19] = GUICtrlCreateLabel("", 110, 398+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Total Test Time:", 8, 432+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[20] = GUICtrlCreateLabel("", 110, 429+$TopDown, 218, 20, BitOR($SS_CENTER, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) #EndRegion #Region --->>> Fixture Information Tab $GUITab[2] = GUICtrlCreateTabitem("Test Information") GUICtrlCreateGroup("Product Information", 5, 25+$TopDown, 330, 150) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Fixture Information", 5, 30+$TopDown, 326, 140, $FontColor, $GroupColor) GUICtrlCreateLabel("Fixture ID:", 8, 50+$TopDown, 100, 25, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[5] = GUICtrlCreateInput("", 110, 47+$TopDown, 218, 20, BitOR($SS_LEFT, $SS_SUNKEN, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Fixture Life Cycle:", 8, 81+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[6] = GUICtrlCreateInput("", 110, 78+$TopDown, 218, 20, BitOR($ES_CENTER, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Current Usages:", 8, 112+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[7] = GUICtrlCreateInput("", 110, 109+$TopDown, 218, 20, BitOR($ES_CENTER, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("UUT Qty/Fixture:", 8, 143+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[8] = GUICtrlCreateCombo("", 110, 140+$TopDown, 218, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetData($InfoTab[8], _UUTNoCombo(), "1") GUICtrlCreateGroup("Station Information", 5, 185+$TopDown, 330, 180) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Station Information", 5, 190+$TopDown, 326, 170, $FontColor, $GroupColor) GUICtrlCreateLabel("Test Station:", 8, 210+$TopDown, 100, 25, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[9] = GUICtrlCreateInput("0", 110, 207+$TopDown, 218, 20) ;~ GUICtrlSetStyle(-1, $ES_READONLY) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Barcode Length:", 8, 241+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[10] = GUICtrlCreateInput("", 110, 238+$TopDown, 218, 20, BitOR($ES_CENTER, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Barcode Prefix:", 8, 272+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[11] = GUICtrlCreateInput("", 110, 269+$TopDown, 218, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Flexflow Status:", 8, 303+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[12] = GUICtrlCreateLabel("OFF", 110, 300+$TopDown, 80, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $White) GUICtrlSetBkColor(-1, $Red) GUICtrlCreateLabel("Stop At Fail:", 8, 334+$TopDown, 100, 20, $SS_RIGHT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $InfoTab[13] = GUICtrlCreateLabel("OFF", 110, 331+$TopDown, 80, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $White) GUICtrlSetBkColor(-1, $Red) #EndRegion #Region --->>> Edit Test Items $GUITab[3] = GUICtrlCreateTabitem("Edit Test Item") GUICtrlCreateGroup("Station Information", 5, 25+$TopDown, 330, 535) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;_GUICtrlCreateGroup(" Test Item Editting ", 5, 30+$TopDown, 326, 525, $FontColor, $GroupColor) GUICtrlCreateLabel("Test Item No. and Name:", 35, 50+$TopDown, 200, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[1] = GUICtrlCreateCombo("", 30, 65+$TopDown, 50, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $iFuncSub[2] = GUICtrlCreateInput("Test Item Name", 90, 65+$TopDown, 210, 20);, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Function/Sub:", 35, 100+$TopDown, 200, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[3] = GUICtrlCreateCombo("Select Function/Sub", 30, 115+$TopDown, 270, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetState(-1, $GUI_DISABLE) ;~ GUICtrlCreateLabel("UUT No.:", 35, 150+$TopDown, 90, 20, $SS_LEFT) ;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;~ GUICtrlSetColor(-1, $FontColor) ;~ $iFuncSub[4] = GUICtrlCreateCombo("", 85, 147+$TopDown, 60, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST)) ;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;~ GUICtrlSetData(-1, "1|2|3|4|5|6|7|8", "1") ;~ GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("Input Parameter:", 20, 150+$TopDown, 302, 165) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $dGap = 21 $iParam[0][0] = GUICtrlCreateLabel("Param", 20, 170+$TopDown, 120, 20, $SS_CENTER);, BitOR($ES_CENTER, $ES_READONLY, $ES_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $iParam[0][1] = GUICtrlCreateLabel("Value", 140, 170+$TopDown, 176, 20, $SS_CENTER);, BitOR($ES_AUTOHSCROLL, $ES_CENTER, $ES_READONLY)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Measurement Min:", 35, 325+$TopDown, 200, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[5] = GUICtrlCreateInput("", 30, 340+$TopDown, 200, 20, BitOR($ES_AUTOHSCROLL, $ES_LEFT)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Measurement Max:", 35, 365+$TopDown, 200, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[6] = GUICtrlCreateInput("", 30, 380+$TopDown, 200, 20, BitOR($ES_AUTOHSCROLL, $ES_LEFT)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Unit:", 35, 405+$TopDown, 200, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[7] = GUICtrlCreateInput("", 30, 420+$TopDown, 200, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlCreateLabel("Retry:", 35, 445+$TopDown, 95, 20, $SS_LEFT) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUICtrlSetColor(-1, $FontColor) $iFuncSub[8] = GUICtrlCreateInput("", 30, 460+$TopDown, 95, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_NUMBER)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;~ GUICtrlCreateLabel("Fail Goto:", 140, 445+$TopDown, 95, 20, $SS_LEFT) ;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) ;~ GUICtrlSetColor(-1, $FontColor) ;~ $iFuncSub[9] = GUICtrlCreateInput("", 135, 460+$TopDown, 95, 20, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_NUMBER)) ;~ GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $iFuncSub[10] = GUICtrlCreateButton("Save", 160, 495+$TopDown, 70, 30) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $iFuncSub[11] = GUICtrlCreateButton("Clear", 240, 495+$TopDown, 70, 30) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) GUISetState(@SW_HIDE, $hGUI) ; Create child window which will be scrollable $hAperture = GUICreate("", 298, 126, 21, 185+$TopDown, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor($White) For $r = 0 To 24 $iParam[$r+1][0] = GUICtrlCreateInput("Param" & $r+1, 2, ($dGap*$r)+2, 120, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER, $ES_READONLY)) GUICtrlSetState($iParam[$r+1][0], $GUI_HIDE) $iParam[$r+1][1] = GUICtrlCreateInput("Vacant", 123, ($dGap*$r)+2, 176, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) GUICtrlSetState($iParam[$r+1][1], $GUI_HIDE) $iParam[$r+1][2] = GUICtrlCreateButton("TRUE", 121, ($dGap*$r)+1, 167, 22);, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) GUICtrlSetState($iParam[$r+1][2], $GUI_HIDE) Next GUISetState(@SW_HIDE, $hAperture) ; make the scrollbars $hScroll = 21 * $r ;~ If $hScroll < 300 Then $hScroll = 320 _GUIScrollbars_Generate($hAperture, 0, $hScroll) GUICtrlCreateTabitem ("") #EndRegion #EndRegion --->> GUI Info Tab #Region -->> Load default test program that been save in configuration file $GetDefProgram = _MDBSearch($fSystemDatabase, $SysDBPassword, "Configuration", "Key", "DefaultProgram", "Value") If FileExists($GetDefProgram) Then _LoadProgramData($GetDefProgram) $GetProgramPath = $GetDefProgram EndIf #EndRegion ---> Load default #Region -->> ListView Color Setting ReDim $aLV1[_GUICtrlListView_GetItemCount($hListView)][_GUICtrlListView_GetColumnCount($hListView)][5] ; create array to hold ListView-handle and accordingly array ;Global $ahWndSets[1][2] = [[$hListView, $aLV1]] $ahWndSets[0][0] = $hListView $ahWndSets[0][1] = $aLV1 ;_DebugArrayDisplay($ahWndSets, "$ahWndSets") #EndRegion -->> ListView Color Setting ; Register the function DateTime() to be called every 500ms, to display current Date and Time AdlibRegister("DateTime", 1000) ; Set Parent window menu _UserAccessSetting($flexATSAccessRight) GUIDelete($LogGUI) ;Delete/Close Login Windows once loading completed ;GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_MAXIMIZE, $hGUI) #Region -->> Set Right Click Menu on Listview Global $idContextmenu = _GUICtrlMenu_CreatePopup() If $flexATSAccessRight <> 4 Then _GUICtrlMenu_InsertMenuItem($idContextmenu, 0, "Insert", $idSubInsert) _GUICtrlMenu_InsertMenuItem($idContextmenu, 1, "Delete", $idSubDelete) _GUICtrlMenu_InsertMenuItem($idContextmenu, 2, "Clear", $idSubClear) _GUICtrlMenu_InsertMenuItem($idContextmenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($idContextmenu, 4, "Cut", $idSubCut) _GUICtrlMenu_InsertMenuItem($idContextmenu, 5, "Copy", $idSubCopy) _GUICtrlMenu_InsertMenuItem($idContextmenu, 6, "Paste", $idSubPaste) EndIf #EndRegion GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $MenuFile[6], $ToolsBtn[13] ;Exit Test Platform _ClearListViewResult() _CompareEditItem() If $ScriptChange = 1 Then $SaveChange = MsgBox($MB_YESNO, $GUITitle, "Test Program Script Has been Change..." & @CRLF & "Do you want to save changes?") If $SaveChange = 6 Then ;~ _DebugArrayDisplay($aProgramInfo) _SaveTestProgram() _SaveTestItem() EndIf EndIf ExitLoop Case $MenuFile[1], $ToolsBtn[1] ;Create New Test Program StatusWrite("Create New Test Program...") Local $NewProgramPath = _NewProgram($hGUI) If $NewProgramPath <> -1 Then GUISetState(@SW_HIDE, $hAperture) GUICtrlSetState($GUITab[1], $GUI_SHOW) _LoadProgramData($NewProgramPath) _TestItemSelected("No.") StatusWrite("New Test Program Loaded...") $GetProgramPath = $NewProgramPath EndIf Case $MenuFile[2], $ToolsBtn[2] ;Open/Load Test Program StatusWrite("Open/Load Program") ProcessClose($EditPID) AdlibUnRegister("_CheckSave") $OpenProgramPath = LoadProgram($hGUI) ;~ WinActivate($hGUI) If $OpenProgramPath <> -1 Then GUISetState(@SW_HIDE, $hAperture) GUICtrlSetState($GUITab[1], $GUI_SHOW) _LoadProgramData($OpenProgramPath) _TestItemSelected("No.") StatusWrite("Test Program Loaded...") $GetProgramPath = $OpenProgramPath EndIf Case $MenuOpt[3] ;Open/Load Old Version Test Program StatusWrite("Open/Load Old Version Test Program...") $LoadOldProgramPath = _ProgramMenu($hGUI) ;~ WinActivate($hGUI) If $LoadOldProgramPath <> -1 Then GUISetState(@SW_HIDE, $hAperture) GUICtrlSetState($GUITab[1], $GUI_SHOW) _LoadProgramData($LoadOldProgramPath) _TestItemSelected("No.") StatusWrite("Test Program Loaded...") $GetProgramPath = $LoadOldProgramPath EndIf Case $MenuOpt[1] ; System configuration _OptionMenu($hGUI) GUICtrlSetData($InfoTab[8], _UUTNoCombo(), $aProductData[_ArraySearch($aProductData, "UUTQty")][1]) Case $MenuFile[4], $ToolsBtn[3] ;Save Button ;ConsoleWrite("$ScriptChange=" & $ScriptChange & @CRLF) If WinExists("[CLASS:Notepad++]") Then WinClose("[CLASS:Notepad++]") AdlibUnRegister("_CheckSave") EndIf _CompareEditItem(1) If StringCompare(GUICtrlRead($iFuncSub[1]), "No.") <> 0 Then _SaveFuncParam() _SaveTestProgram() _SaveTestItem() _ClearListViewResult() $aOriTestItemData = $aTestItemData $ScriptChange = 0 ;~ AdlibUnRegister("_CheckSave") StatusWrite("Test Program Saved...") Case $ToolsBtn[4] ; Cancel Changes $aTestItemData = $aOriTestItemData _FixRowNo_Date() ; Updated list view data _UpdateListView() StatusWrite("Restore All Changes...") Case $InfoTab[12] ;Flexflow On or Off _SetONOFF($InfoTab[12], GUICtrlRead($InfoTab[12]), "ON") Case $InfoTab[13] ;Flexflow On or Off _SetONOFF($InfoTab[13], GUICtrlRead($InfoTab[13]), "ON") Case $ItemInsert, $MenuEdit[6] ;Insert New Row $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _ArrayInsert($aTestItemData, $ClickedRow, $ClickedRow + 1) _FixRowNo_Date() ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData after Insert") _UpdateListView() StatusWrite("New Test Item Row Inserted...") Case $ItemDel, $ToolsBtn[9], $MenuEdit[7] ;Delete Row $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _GUICtrlListView_DeleteItemsSelected($ListViewTbl) StatusWrite("Deleted Test Item: " & $ClickedRow+1 & " - " & $aTestItemData[$ClickedRow][2] ) _ArrayDelete($aTestItemData, $ClickedRow) ; Update test items numbering and fix date _FixRowNo_Date() ; Updated list view data _UpdateListView() Case $ItemClear ;Clear Row Data $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _GUICtrlListView_DeleteItemsSelected($ListViewTbl) StatusWrite("Test Item Row Clear...") _ArrayClearRow($ClickedRow) ; Update test items numbering and fix date _FixRowNo_Date() ; Updated list view data _ClearListViewResult() _UpdateListView() Case $ItemCut, $ToolsBtn[6], $MenuEdit[3] ;Cut Row Data $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _GUICtrlListView_DeleteItemsSelected($ListViewTbl) $aGetData = _ArrayGetData($ClickedRow) _ArrayDelete($aTestItemData, $ClickedRow) ; Update test items numbering and fix date _FixRowNo_Date() ; Updated list view data _ClearListViewResult() _UpdateListView() StatusWrite("Test Item Row Cut...") Case $ItemCopy, $ToolsBtn[7], $MenuEdit[4] ;Copy Row Data $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) ;~ _GUICtrlListView_DeleteItemsSelected($ListViewTbl) $aGetData = _ArrayGetData($ClickedRow) ; Update test items numbering and fix date _FixRowNo_Date() ; Updated list view data _ClearListViewResult() _UpdateListView() StatusWrite("Test Item Row Cut...") Case $ItemPaste, $ToolsBtn[8], $MenuEdit[5] ;Paste Row Data from Cut/Copy onto current selected Row $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _GUICtrlListView_DeleteItemsSelected($ListViewTbl) _ArrayInsertData($ClickedRow, $aGetData) ; Update test items numbering and fix date _FixRowNo_Date() ; Updated list view data ;~ _ClearListViewResult() _UpdateListView() _TestItemSelected(GUICtrlRead($iFuncSub[1])) StatusWrite("Test Item Paste...") Case $GUITab[0] If GUICtrlRead($GUITab[0]) = 2 Then GUISetState(@SW_SHOW, $hAperture) Else GUISetState(@SW_HIDE, $hAperture) EndIf If $GetProgramPath <> "" Then _CompareEditItem() Case $iFuncSub[10] ;Param Save Button If WinExists("[CLASS:Notepad++]") Then WinClose("[CLASS:Notepad++]") AdlibUnRegister("_CheckSave") EndIf _SaveFuncParam() _SaveTestItem() _UpdateListView() Case $iFuncSub[11] ;Param Clear Button _ClearFuncSub() Case $iFuncSub[1] ; Test Item Number _TestItemSelected(GUICtrlRead($iFuncSub[1])) Case $iFuncSub[3] ; FuncSubCombo $rFuncSubRead = GUICtrlRead($iFuncSub[3]) If StringCompare($rFuncSubRead, "Select Function/Sub") <> 0 Then Local $i = _ArraySearch($aFuncSubList, $rFuncSubRead) $aReadParamName = _aReadParamName($i) ;~ _DebugArrayDisplay($aReadParamName, "$aReadParamName") ;create a empty value for set parameter, set new value for selected function Local $aEmptyValue[UBound($aReadParamName)+1] ; Set param list view _SetParamInput($aReadParamName, $aEmptyValue) Else For $r = 1 To 25 GUICtrlSetData($iParam[$r][0], "") GUICtrlSetData($iParam[$r][1], "") GUICtrlSetState($iParam[$r][0], $GUI_HIDE) GUICtrlSetState($iParam[$r][1], $GUI_HIDE) GUICtrlSetState($iParam[$r][2], $GUI_HIDE) Next EndIf ; Clear setting data when new function or sub been selected GUICtrlSetData($iFuncSub[2], "") GUICtrlSetData($iFuncSub[5], "") GUICtrlSetData($iFuncSub[6], "") GUICtrlSetData($iFuncSub[7], "") GUICtrlSetData($iFuncSub[8], "") ;~ GUICtrlSetData($iFuncSub[9], "") Case $iParam[1][2], $iParam[2][2], $iParam[3][2], $iParam[4][2], $iParam[5][2], $iParam[6][2], $iParam[7][2], $iParam[8][2], $iParam[9][2], $iParam[10][2], $iParam[11][2], $iParam[12][2], $iParam[13][2], $iParam[14][2], $iParam[15][2], $iParam[16][2], $iParam[17][2], $iParam[18][2], $iParam[19][2], $iParam[20][2], $iParam[21][2], $iParam[22][2], $iParam[23][2], $iParam[24][2], $iParam[25][2] For $r = 1 To 25 If StringCompare(GUICtrlRead($iParam[$r][2]), "TRUE") = 0 Then GUICtrlSetData($iParam[$r][2], "FALSE") GUICtrlSetColor($iParam[$r][2], $Red) Else GUICtrlSetData($iParam[$r][2], "TRUE") GUICtrlSetColor($iParam[$r][2], $Green) EndIf Next Case $ToolsBtn[5] ; Edit VBScript ;~ ShellExecute("wscript.exe", "TempTestProgram.vbs", ) Local $ScriptFile = '"' & @ScriptDir & '\TempTestProgram.vbs"' $EditPID = Run($ScriptEditting & " " & $ScriptFile) ;ConsoleWrite("Run($ScriptEditting) ProcessID " & $EditVBsPID & @CRLF) $VBsFileBefore = FileGetTime($ScriptFile, $FT_MODIFIED, $FT_STRING) AdlibRegister("_CheckSave", 1000) Case $ToolsBtn[10], $MenuRun[1] ; Run Button _RunTest() EndSwitch WEnd AdlibUnRegister("_CheckSave") AdlibUnRegister("DateTime") GUIDelete($hGUI) EndFunc ;==>MainPage Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $iIDFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Switch $iIDFrom Case $ListViewTbl, $hListView Switch $iCode Case $NM_RCLICK $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) If DllStructGetData($tInfo, "Item") > -1 Then _GUICtrlMenu_TrackPopupMenu($idContextmenu, $hGUI) EndIf Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $ItemNo = DllStructGetData($tInfo, "Index") + 1 If $ItemNo = 0 Then $ItemNo = "No." GUICtrlSetData($iFuncSub[1], "") GUICtrlSetData($iFuncSub[1], $rItemCombo, $ItemNo) _TestItemSelected($ItemNo) Case $NM_CUSTOMDRAW If Not _GUICtrlListView_GetViewDetails($hWndFrom) Then Return $GUI_RUNDEFMSG Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam) Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRect $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage') Switch $iDrawStage Case $CDDS_ITEMPREPAINT Return $CDRF_NOTIFYSUBITEMDRAW Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM) $iItem = DllStructGetData($tCustDraw, 'dwItemSpec') $iSubitem = DllStructGetData($tCustDraw, 'iSubItem') If BitAND(__GUICtrlListView_GetItemParam($hWndFrom, $iItem), 2^$iSubitem) Then _DrawItemCol($hDC, $tCustDraw, $hWndFrom, $iItem, $iSubitem) Else _DrawDefault($hDC, $tCustDraw) EndIf Return $CDRF_NEWFONT EndSwitch Endswitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Switch $iwParam Case $idSubInsert GUICtrlSendToDummy($ItemInsert) Case $idSubDelete GUICtrlSendToDummy($ItemDel) Case $idSubClear GUICtrlSendToDummy($ItemClear) Case $idSubCut GUICtrlSendToDummy($ItemCut) Case $idSubCopy GUICtrlSendToDummy($ItemCopy) Case $idSubPaste GUICtrlSendToDummy($ItemPaste) Case $ToolsBtn[11], $MenuRun[2] ; Single Step Button $ClickedRow = _GUICtrlListView_GetSelectedIndices($ListViewTbl) _RunTest($ClickedRow) Case $ToolsBtn[12], $MenuRun[3] ; Stop Test Button $StopTest = 1 ;If $flexATSAccessRight <> 4 Then _DisableAllBtn($GUI_ENABLE) ;~ Case $MenuRun[1] ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") ;~ Case $MenuRun[2] ;~ _DebugArrayDisplay($aFuncSubList, "$aFuncSubList") ;~ Case $MenuRun[3] ;~ _DebugArrayDisplay($aFFTestData, "$aFFTestData") Case $MenuRun[4] ; Set Debug Mode If BitAND(GUICtrlRead($MenuRun[4]), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($MenuRun[4], $GUI_UNCHECKED) IniWrite($ConfigFile, "General", "Debug Mode", "0") $DebugMode = IniRead($ConfigFile, "General", "Debug Mode", "0") ;GUISetBkColor($LightGreen, $hGUI) Else GUICtrlSetState($MenuRun[4], $GUI_CHECKED) IniWrite($ConfigFile, "General", "Debug Mode", "1") $DebugMode = IniRead($ConfigFile, "General", "Debug Mode", "0") ;GUISetBkColor($LightYellow, $hGUI) EndIf EndSwitch EndFunc ;==>WM_COMMAND Func _CheckSave() ; check is VBScript been modify ;ConsoleWrite("Check VBScript File Modification..." & @CRLF) Local $ScriptFile = @ScriptDir & "\TempTestProgram.vbs" $VBsFileAfter = FileGetTime($ScriptFile, $FT_MODIFIED, $FT_STRING) If StringCompare($VBsFileBefore, $VBsFileAfter) <> 0 Then $aFuncSubList = _LoadVBScript($ScriptFile) ;ConsoleWrite("New VBScript loaded..." & @CRLF) GUICtrlSetData($iFuncSub[3], "") $rFuncSubCombo = "Select Function/Sub" For $r = 1 To UBound($aFuncSubList) -1 $rFuncSubCombo = $rFuncSubCombo & "|" & $aFuncSubList[$r][0] Next GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, "Select Function/Sub") $VBsFileBefore = $VBsFileAfter ;_UpdateListView() StatusWrite("New VBScript loaded...") $ScriptChange = 1 EndIf EndFunc Func _F5Run() _RunTest(-1) EndFunc Func _F7Stop() $StopTest = 1 EndFunc Func _CloseBarcode() ReDim $aBarcodeSN[2][2] $aBarcodeSN[0][0] = "Barcode" $aBarcodeSN[0][1] = "Result" $aBarcodeSN[1][0] = "DummyBarcode" $aBarcodeSN[1][1] = "Passed" ;_DisableAllBtn($GUI_ENABLE) ;If $flexATSAccessRight = 4 Then ; GUICtrlSetState($ToolsBtn[13], $GUI_ENABLE) ; GUICtrlSetState($ToolsBtn[2], $GUI_ENABLE) ;EndIf $FF_ESC_Exit = 2 GUICtrlSendToDummy($ibOK) EndFunc Func _RunTest($iRow = -1) ; Close Editor notepad++ If WinExists("[CLASS:Notepad++]") Then WinClose("[CLASS:Notepad++]") AdlibUnRegister("_CheckSave") EndIf Local $StartRow, $EndRow, $RetValue, $TestResult, $RetValueSet, $TestResultSet="Passed" Local $StopAtFail=0 Local $UUTQty = GUICtrlRead($InfoTab[8]) ReDim $aBarcodeSN[$UUTQty+1][2] ReDim $aFFTestData[1][15][$UUTQty+1] $FinalResult = 1 ; Set as pass at the beginning of run test _DisableAllBtn() ; Disable unecessary button during test ;Check test program running mode If $iRow = -1 Then If $DebugMode = 0 Then $BarcodeLen = $aProductData[_ArraySearch($aProductData, "BarcodeLength")][1] $aBarcodeSN = _BarcodeInput($hGUI, $UUTQty, $BarcodeLen, $DummyBarcode) ;_DebugArrayDisplay($aBarcodeSN, "$aBarcodeSN") Else ;_DebugArrayDisplay($aBarcodeSN, "iRow = -1") For $r = 1 To $UUTQty $aBarcodeSN[$r][0] = "Dummy_" & $r & "_" & $DummyBarcode $aBarcodeSN[$r][1] = "Passed" Next EndIf Else For $r = 1 To $UUTQty $aBarcodeSN[$r][0] = "Dummy_" & $r & "_" & $DummyBarcode $aBarcodeSN[$r][1] = "Passed" Next EndIf ;_DebugArrayDisplay($aBarcodeSN, "$aBarcodeSN") For $r = 1 To $UUTQty If StringCompare($aBarcodeSN[$r][1], "Failed") = 0 Then ;MsgBox(0, "Flexflow Route error", "Error Routing") $FF_ESC_Exit = 1 ExitLoop EndIf Next If $FF_ESC_Exit = 0 Then ; Record/Log start testing time $StartTestTime = _NowCalc() GUICtrlSetData($InfoTab[18], $StartTestTime) GUICtrlSetData($InfoTab[19], "") GUICtrlSetData($InfoTab[20], "") StatusWrite("Start Testing...") GUICtrlSetData($StatusEdit, "Testing...") GUICtrlSetColor($StatusEdit, $Orange) _ClearListViewResult() ;_UpdateListView() ; Reset Stop button $StopTest = 0 If Not IsObj($oScriptControl) Then _ReloadVBScript() EndIf If $iRow <> -1 Then $StartRow = $iRow $EndRow = $iRow ;ConsoleWrite("Start single test: " & $StartRow & @CRLF) Else $StartRow = 0 $EndRow = UBound($aTestItemData)-1 EndIf $f = 0 ;array number skip for "False" Print Resullt For $r = $StartRow To $EndRow $ExeFunc = StringSplit($aTestItemData[$r][9], "|") ;~ _DebugArrayDisplay($ExeFunc, "$ExeFunc") _GUICtrlListView_AddSubItem($ListViewTbl, $r, "Testing", 7) If StringCompare($aTestItemData[$r][1], "TRUE") = 0 Then ; Check if Function sent is correct.. If StringCompare($ExeFunc[$ExeFunc[0]], $aTestItemData[$r][2]) = 0 Then ; Execute Script Test $StartTime = _NowCalc() StatusWrite($StartTime & " - Testing: " & $aTestItemData[$r][3]) If StringCompare($ExeFunc[UBound($ExeFunc)-2], "TRUE") = 0 Then $f = $f + 1 $RetryCount = Int($aTestItemData[$r][7]) For $Retry = 0 To 4 ; Max retry time is 5 times ;~ ;ConsoleWrite("Send ScriptControl..." & @CRLF) $RetValue = _ScriptControlRun($ExeFunc, $UUTQty) If IsArray($RetValue) Then ;~ _DebugArrayDisplay($RetValue, "$TestResult") For $aResult = 0 To UBound($RetValue)-1 If StringInStr($RetValue[$aResult], "|") > 0 Then $vSplit = StringSplit($RetValue[$aResult], "|") $RetValue[$aResult] = StringStripWS($vSplit[1], 8) If StringCompare($aTestItemData[$r][2], "Read_SN") = 0 Then ;;ConsoleWrite($aTestItemData[$r][2] & " - In Read_SN" & @CRLF) _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aBarcodeSN[1][0], 3) _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aBarcodeSN[1][0], 4) $aTestItemData[$r][4] = $aBarcodeSN[1][0] $aTestItemData[$r][5] = $aBarcodeSN[1][0] Else ;;ConsoleWrite($aTestItemData[$r][2] & " - Else SN" & @CRLF) _GUICtrlListView_AddSubItem($ListViewTbl, $r, $vSplit[1], 3) _GUICtrlListView_AddSubItem($ListViewTbl, $r, $vSplit[1], 4) $aTestItemData[$r][4] = StringStripWS($vSplit[1], 8) $aTestItemData[$r][5] = StringStripWS($vSplit[1], 8) EndIf EndIf $TestResult = _ResultCompare($RetValue[$aResult], $aTestItemData[$r][4], $aTestItemData[$r][5]) ; Flexflow data $EndTime = _NowCalc() ;~ ;ConsoleWrite($r & " - PARAM FF: " & $ExeFunc[UBound($ExeFunc)-2] & @CRLF) If StringCompare($ExeFunc[UBound($ExeFunc)-2], "TRUE") = 0 Then ;~ $f = $f + 1 If $iRow = -1 And $DebugMode = 0 Then _SaveFlexFlowArray($aResult+1, $f, $r, $RetValue[$aResult], $TestResult, $StartTime, $EndTime, $UUTQty) EndIf $RetValueSet = $RetValue[$aResult] $TestResultSet = $TestResult ;~ If $iRow = -1 Then $aBarcodeSN[$aResult+1][1] = $TestResult If StringCompare($TestResult, "Failed") = 0 Then $RetValueSet = $RetValue[$aResult] $TestResultSet = "Failed" $aBarcodeSN[$aResult+1][1] = "Failed" $FinalResult = 0 If StringCompare(GUICtrlRead($InfoTab[13]), "ON") = 0 Then $StopAtFail = 1 EndIf Next If StringCompare($TestResult, "Passed") = 0 Then ExitLoop EndIf If $Retry = $RetryCount Then ExitLoop Next ;If StringCompare($TestResultSet, "Failed") = 0 Then ; _SetItemParam($hListView, $r, 6, $White, $Red) ; _SetItemParam($hListView, $r, 7, $White, $Red) ;Else ; _SetItemParam($hListView, $r, 6, $White, $Green) ; _SetItemParam($hListView, $r, 7, $White, $Green) ;EndIf _GUICtrlListView_AddSubItem($ListViewTbl, $r, $RetValueSet, 6) _GUICtrlListView_AddSubItem($ListViewTbl, $r, $TestResultSet, 7) EndIf ; Check if Function sent is correct.. Else _GUICtrlListView_AddSubItem($ListViewTbl, $r, "Skiped", 7) ;_SetItemParam($hListView, $r, 7, $White, $Orange) EndIf ;If StringCompare($aTestItemData[$r][1], "TRUE") = 0 Then ; Stop testing when Stop Button Pushed!! If $StopTest = 1 Then ExitLoop ; Stop testing when test items failed!! If $StopAtFail = 1 Then ExitLoop ; Auto scroll listview display $iY = _GUICtrlListView_GetItemPositionY($ListViewTbl, $r) _GUICtrlListView_Scroll($ListViewTbl, 0, $iY) Next StatusWrite("Test Ended...") If $StopTest <> 1 And $iRow = -1 And $DebugMode = 0 Then For $rUUT = 1 To $UUTQty $xmlFile = _CreateXML($rUUT) If StringCompare(GUICtrlRead($InfoTab[12]), "ON") = 0 Then If $StopAtFail = 1 Then $iYesNo = MsgBox($MB_YESNO, $GUITitle, "Do you want to upload failed unit into flexflow?") If $iYesNo = 6 Then _FFSaveResult($aBarcodeSN[$rUUT][0], $xmlFile) EndIf Else _FFSaveResult($aBarcodeSN[$rUUT][0], $xmlFile) EndIf EndIf Next EndIf EndIf ; Enable all Push button after test program execution If $flexATSAccessRight <> 4 Then _DisableAllBtn($GUI_ENABLE) If $flexATSAccessRight = 4 Then GUICtrlSetState($ToolsBtn[13], $GUI_ENABLE) GUICtrlSetState($ToolsBtn[2], $GUI_ENABLE) EndIf ;~ _DebugArrayDisplay($aBarcodeSN, "$aBarcodeSN") #Region ; Set/Update Test Time Information Group $EndTestTime = _NowCalc() $iTime2GoSec = _DateDiff('s', $StartTestTime, $EndTestTime) $iTime2GoMin = Int($iTime2GoSec / 60) $iTime2GoSec = Mod($iTime2GoSec, 60) ; Display result - adding padding 0 to Sec if required $TotalTestTime = StringFormat("%02i", $iTime2GoMin) & ":" & StringFormat("%02i", $iTime2GoSec) GUICtrlSetData($InfoTab[19], $EndTestTime) GUICtrlSetData($InfoTab[20], $TotalTestTime) #EndRegion #Region ; Set/Update Test Yield Information Local $cTtlUnit, $cPassUnit, $cFailUnit, $cFPY $cTtlUnit = Int(GUICtrlRead($InfoTab[14])) + 1 ; Total Tested Unit GUICtrlSetData($InfoTab[14], $cTtlUnit) If $FinalResult = 1 Then If $FF_ESC_Exit = 0 Then $cPassUnit = Int(GUICtrlRead($InfoTab[15])) + 1 ; Total Passed Unit GUICtrlSetData($InfoTab[15], $cPassUnit) GUICtrlSetData($StatusEdit, "PASSED") GUICtrlSetColor($StatusEdit, $Green) EndIf Else $cFailUnit = Int(GUICtrlRead($InfoTab[16])) + 1 ; Total Failed Unit GUICtrlSetData($InfoTab[16], $cFailUnit) If $StopTest = 1 Then GUICtrlSetData($StatusEdit, "STOPPED") GUICtrlSetColor($StatusEdit, $Red) Else GUICtrlSetData($StatusEdit, "FAILED") GUICtrlSetColor($StatusEdit, $Red) EndIf EndIf If $FF_ESC_Exit = 1 Then GUICtrlSetData($StatusEdit, "FlexFlow Error") GUICtrlSetColor($StatusEdit, $Red) ElseIf $FF_ESC_Exit = 2 Then GUICtrlSetData($StatusEdit, "Abort") GUICtrlSetColor($StatusEdit, $Red) ElseIf $StopTest = 1 Then GUICtrlSetData($StatusEdit, "STOPPED") GUICtrlSetColor($StatusEdit, $Red) EndIf $cFPY = Round($cPassUnit/$cTtlUnit*100, 2) GUICtrlSetData($InfoTab[17], $cFPY & "%") #EndRegion If $FF_ESC_Exit <> 2 And $flexATSAccessRight = 4 Then _RunTest() EndFunc Func _SaveFlexFlowArray($Bar, $f, $r, $RetValue, $TestResult, $StartTime, $EndTime, $UUTQty) ReDim $aFFTestData[$f+1][15][$UUTQty+1] ;;ConsoleWrite("_SaveFlexFlowArray:"& $aTestItemData[$r][3] & " - " & $RetValue & @CRLF) ;~ $aFFTestData[1][15] = [["GROUP NAME", "TYPE", "MODULETIME/TOTALTIME", "TIMESTAMP", "Group STATUS", "TEST NAME", "DESCRIPTION", "UNIT", "VALUE", "HILIM", "LOLIM", "STATUS", "RULE", "TARGET", "DATATYPE"]] $aFFTestData[$f][0][$Bar] = $aTestItemData[$r][3] ; Test Item Name/Group Name $aFFTestData[$f][1][$Bar] = _NumericOrString($aTestItemData[$r][4]) ; TYPE "NumericLimitTest"/"TEXT" $aFFTestData[$f][2][$Bar] = _DateDiff('s', $StartTime, $EndTime) ; MODULETIME/TOTALTIME $aFFTestData[$f][3][$Bar] = StringReplace(_NowCalc(), "/", "-") ; TIMESTAMP YYYY/MM/DD HH:MM:SS to "2019-10-15 20:28:05" $aFFTestData[$f][4][$Bar] = $TestResult ; STATUS Passed/Failed $aFFTestData[$f][5][$Bar] = $aTestItemData[$r][3] ; TEST NAME $aFFTestData[$f][6][$Bar] = $aTestItemData[$r][2] ; DESCRIPTION (Function or Sub Name) $aFFTestData[$f][7][$Bar] = $aTestItemData[$r][6] ; UNIT $aFFTestData[$f][8][$Bar] = $RetValue ; VALUE $aFFTestData[$f][9][$Bar] = $aTestItemData[$r][5] ; HILIM $aFFTestData[$f][10][$Bar] = $aTestItemData[$r][4] ; LOLIM $aFFTestData[$f][11][$Bar] = $TestResult ; STATUS $aFFTestData[$f][12][$Bar] = "EQ" ; RULE $aFFTestData[$f][13][$Bar] = "" ; TARGET - Hi/Low limit average or actual expected value $aFFTestData[$f][14][$Bar] = _NumericOrString($aTestItemData[$r][4]) ; DATATYPE "NumericLimitTest"/"TEXT" EndFunc Func _CreateXML($UUT = 1) Local $xmlTemp = @TempDir & "\TempSaveResult.xml" Local $StartTime = _NowCalc() Local $DateTime = StringReplace($StartTime, "/", "-") Local $rStation = $hFFStation Local $rFixture = GUICtrlRead($InfoTab[5]) Local $rModel = GUICtrlRead($InfoTab[1]) Local $rModelRev = GUICtrlRead($InfoTab[1]) Local $rCustomer = $aProductData[_ArraySearch($aProductData, "Customer")][1] Local $rTTestTime = _DateDiff("s", $StartTestTime, $EndTestTime) Local $SerialNumber = $aBarcodeSN[$UUT][0] Local $FinalTestResult = $aBarcodeSN[$UUT][1] $fileDataTime = StringStripWS(StringReplace(StringReplace($StartTime, "/", ""), ":", ""), $STR_STRIPALL) Local $xmlFileName = $FFxmlPath & "\" & @YEAR&@MON&@MDAY & "\SaveResult_" & $SerialNumber & "_" & $fileDataTime & ".xml" #Region ;-->> BATCH Data ;$xmlns="http://www.flextronics.com/fts/sfs/res" ;Dim $BatchLoad[4] = ["xmlns", "TIMESTAMP", "SYNTAX_REV", "COMPATIBLE_REV"] ;Dim $BatchData[4] = [$xmlns, $DateTime, "1.1", "1.1"] Dim $BatchLoad[3] = ["TIMESTAMP", "SYNTAX_REV", "COMPATIBLE_REV"] Dim $BatchData[3] = [$DateTime, "1.1", "1.1"] ;Create file (force overwrite existing file) $result = _XMLCreateFile($xmlTemp, "BATCH", $BatchLoad, $BatchData, True) #EndRegion #Region ;-> <FACTORY NAME="" LINE="" TESTER="A_AT1" FIXTURE="" SHIFT="" USER="administrator" /> Dim $FactoryLoad[6] = ["NAME", "LINE", "TESTER", "FIXTURE", "SHIFT", "USER"] Dim $FactoryData[6] = ["flextronics", "", $rStation, $rFixture, "", $flexATSUser] _XMLCreateRootAttr($xmlTemp, "BATCH", "FACTORY", $FactoryLoad, $FactoryData) #EndRegion #Region ;-> <PRODUCT NAME="Phone One" REVISION="P1" FAMILY="" CUSTOMER="" /> Dim $ProductLoad[4] = ["NAME", "REVISION", "FAMILY", "CUSTOMER"] Dim $ProductData[4] = [$rModel, $rModelRev, "", $rCustomer] _XMLCreateRootAttr($xmlTemp, "BATCH", "PRODUCT", $ProductLoad, $ProductData) #EndRegion ;#Region ;-> <REFS SEQ_REF="C:\FTS\Apps\Commodity GSM\Board_Level\Commodity GSM Board Level Test PD3.seq" FTS_REF="PM:v036,INT:V034(CFG:V013,RES:0.A9,MEA:1.14)" LIM_REF="" CFG_REF="C:\FTS\Apps\Commodity GSM\Board_Level\Commodity GSM Board Level Test PA1.cfg" CAL_REF="" INSTR_REF="" /> ;Dim $REFSLoad[6] = ["SEQ_REF", "FTS_REF", "LIM_REF", "CFG_REF", "CAL_REF", "INSTR_REF"] ;Dim $REFSData[6] = ["FlexATS 4.0", "", "", "", ""] ;_XMLCreateRootAttr($xmlTemp, "BATCH", "REFS", $REFSLoad, $REFSData) ;#EndRegion #Region ;-> <PANEL ID="Undef" COMMENT="" RUNMODE="Debug" TIMESTAMP="2003-02-06 19:05:46.210674" TESTTIME="284.253411" WAITTIME="0.000000" STATUS=""> Dim $PanelLoad[7] = ["ID", "COMMENT", "RUNMODE", "TIMESTAMP", "TESTTIME", "WAITTIME", "STATUS"] Dim $PanelData[7] = ["Undef", "", "Debug", $DateTime, $rTTestTime, "", ""] _XMLCreateRootNode($xmlTemp, "BATCH", "PANEL", $PanelLoad, $PanelData) #EndRegion #Region ;-> <DUT ID="2345" COMMENT="" PANEL="0" SOCKET="0" TIMESTAMP="2003-02-06 19:05:46.210674" TESTTIME="284.253411" STATUS="Passed"> Dim $DUTLoad[7] = ["ID", "COMMENT", "PANEL", "SOCKET", "TIMESTAMP", "TESTTIME", "STATUS"] Dim $DUTData[7] = [$SerialNumber, "", "0", "0", $DateTime, $rTTestTime, $FinalTestResult] _XMLCreateRootNode($xmlTemp, "PANEL", "DUT", $DUTLoad, $DUTData) #EndRegion #Region ;-> Test Equipment ID Group & Name ;<GROUP NAME="Read Equipment ID" STEPGROUP="Main" GROUPINDEX="1" LOOPINDEX="-1" TYPE="" RESOURCE="" MODULETIME="0.0" TOTALTIME="0.0" TIMESTAMP="2019-10-15 20:28:05" STATUS="Passed"> Dim $GroupLoad[10] = ["NAME", "STEPGROUP", "GROUPINDEX", "LOOPINDEX", "TYPE", "RESOURCE", "MODULETIME", "TOTALTIME", "TIMESTAMP", "STATUS"] Dim $GroupData[10] = ["Read Equipment ID", "Main", "1", "-1", "", "", "0.0", "0.0", $DateTime, "Passed"] _XMLCreateRootNode($xmlTemp, "DUT", "GROUP", $GroupLoad, $GroupData) ;<TEST NAME="Equipment_ID" DESCRIPTION="Equipment_ID" UNIT="" VALUE="DONM0303" HILIM="" LOLIM="" STATUS="Passed" RULE="GELE" TARGET="" DATATYPE="Text" /> Dim $TestLoad[10] = ["NAME", "DESCRIPTION", "UNIT", "VALUE", "HILIM", "LOLIM", "STATUS", "RULE", "TARGET", "DATATYPE"] Dim $TestData[10] = ["Equipment_ID", "Equipment_ID", "", @ComputerName, "", "", "Passed", "GELE", "", "Text"] _XMLCreateRootAttr($xmlTemp, "GROUP", "TEST", $TestLoad, $TestData) #EndRegion For $r = 1 To UBound($aFFTestData)-1 ;~ ;-> <GROUP NAME="Output Test" STEPGROUP="Main" GROUPINDEX="0" LOOPINDEX="-1" TYPE="NumericLimitTest" RESOURCE="" MODULETIME="1.336011" TOTALTIME="1.337166" TIMESTAMP="2003-02-06 19:05:47.837478" STATUS="Passed"> Dim $GroupResultLoad[10] = ["NAME", "STEPGROUP", "GROUPINDEX", "LOOPINDEX", "TYPE", "RESOURCE", "MODULETIME", "TOTALTIME", "TIMESTAMP", "STATUS"] ;~ Dim $GroupResultData[10] = [$aFFTestData[$r][0], "Main", $r+1, "-1", $aFFTestData[$r][1], "", $aFFTestData[$r][2], $aFFTestData[$r][2], $aFFTestData[$r][3], $aFFTestData[$r][4]] Dim $GroupResultData[10] = [$aFFTestData[$r][0][$UUT], "Main", $r+1, "-1", $aFFTestData[$r][1][$UUT], "", $aFFTestData[$r][2][$UUT], $aFFTestData[$r][2][$UUT], $aFFTestData[$r][3][$UUT], $aFFTestData[$r][4][$UUT]] _XMLCreateRootNode($xmlTemp, "DUT", "GROUP"&$r, $GroupResultLoad, $GroupResultData) Dim $TestResultLoad[10] = ["NAME", "DESCRIPTION", "UNIT", "VALUE", "HILIM", "LOLIM", "STATUS", "RULE", "TARGET", "DATATYPE"] ;~ Dim $TestResultData[10] = [$aFFTestData[$r][5], $aFFTestData[$r][6], $aFFTestData[$r][7], $aFFTestData[$r][8], $aFFTestData[$r][9], $aFFTestData[$r][10], $aFFTestData[$r][11], $aFFTestData[$r][12], $aFFTestData[$r][13], $aFFTestData[$r][14]] Dim $TestResultData[10] = [$aFFTestData[$r][5][$UUT], $aFFTestData[$r][6][$UUT], $aFFTestData[$r][7][$UUT], $aFFTestData[$r][8][$UUT], $aFFTestData[$r][9][$UUT], $aFFTestData[$r][10][$UUT], $aFFTestData[$r][11][$UUT], $aFFTestData[$r][12][$UUT], $aFFTestData[$r][13][$UUT], $aFFTestData[$r][14][$UUT]] _XMLCreateRootAttr($xmlTemp, "GROUP"&$r, "TEST", $TestResultLoad, $TestResultData) Next #Region ; Temp fix for group issues on xml, remove numbering "$r" $rString = FileRead($xmlTemp) For $r = 0 To UBound($aFFTestData)-1 $rString = StringReplace($rString, "GROUP"&$r&" NAME", "GROUP NAME") $rString = StringReplace($rString, "GROUP"&$r&">", "GROUP>") Next Local $hFileOpen = FileOpen($xmlFileName, 10) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") EndIf FileWrite($hFileOpen, $rString) FileClose($hFileOpen) $rString = "" ; Free up memory #EndRegion ;ConsoleWrite(_NowCalc() & @CRLF) ;ConsoleWrite("Processing Time(Sec): " & _DateDiff('s',$StartTime , _NowCalc()) & @CRLF) Return $xmlFileName EndFunc Func _LoadProgramData($aProgramPath) #Region -->> Load Product Program Information $aProductData = _ParserDataToArray($aProgramPath, $MDBPassword, "Product Information") ;~ _DebugArrayDisplay($aProductData) If Not IsArray($aProductData) Then Return -1 GUICtrlSetData($InfoTab[1], $aProductData[_ArraySearch($aProductData, "ModelName")][1]) GUICtrlSetData($InfoTab[2], $aProductData[_ArraySearch($aProductData, "ModelDesc")][1]) GUICtrlSetData($InfoTab[3], $aProductData[_ArraySearch($aProductData, "ModelPN")][1]) GUICtrlSetData($InfoTab[4], $aProductData[_ArraySearch($aProductData, "ModelRev")][1]) GUICtrlSetData($InfoTab[5], $aProductData[_ArraySearch($aProductData, "FixtureID")][1]) GUICtrlSetData($InfoTab[6], $aProductData[_ArraySearch($aProductData, "LifeCycle")][1]) GUICtrlSetData($InfoTab[7], $aProductData[_ArraySearch($aProductData, "CurrentCycle")][1]) GUICtrlSetData($InfoTab[8], $aProductData[_ArraySearch($aProductData, "UUTQty")][1]) GUICtrlSetData($InfoTab[9], $aProductData[_ArraySearch($aProductData, "TestStation")][1]) GUICtrlSetData($InfoTab[10], $aProductData[_ArraySearch($aProductData, "BarcodeLength")][1]) GUICtrlSetData($InfoTab[11], $aProductData[_ArraySearch($aProductData, "BarcodePrefix")][1]) _SetONOFF($InfoTab[12], $aProductData[_ArraySearch($aProductData, "FlexFlow")][1], "0") _SetONOFF($InfoTab[13], $aProductData[_ArraySearch($aProductData, "StopAtFail")][1], "0") #EndRegion #Region -->> Load VBs Code $FileName = $aProductData[_ArraySearch($aProductData, "TestStationName")][1] $ReadFile = _ParserDataToArray($aProgramPath, $MDBPassword, "[Test Program]", "[Attachment]", "[Filename] = '" & $FileName & "'") ;~ _DebugArrayDisplay($ReadFile, "$ReadFile") If IsArray($ReadFile) Then Local $VBsFile = @ScriptDir & "\TempTestProgram.vbs" ; Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($VBsFile, 10) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") FileWrite($hFileOpen, BinaryToString($ReadFile[0][0], $SB_UTF16LE)) FileClose($hFileOpen) If FileExists($VBsFile) Then $aFuncSubList = _LoadVBScript($VBsFile) ;~ Load into Function/Sub Select Combo GUICtrlSetData($iFuncSub[3], "") $rFuncSubCombo = "Select Function/Sub" For $r = 1 To UBound($aFuncSubList) -1 $rFuncSubCombo = $rFuncSubCombo & "|" & $aFuncSubList[$r][0] Next GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, "Select Function/Sub") Else MsgBox($MB_SYSTEMMODAL, "flexATS", "VB Script file not found...") EndIf EndIf #EndRegion #Region -->> Load Test Item $aTestItemData = _ParserDataToArray($aProgramPath, $MDBPassword, "[Test Items]") ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") ; Set number row in to integer For $r = 0 To UBound($aTestItemData)-1 $aTestItemData[$r][0] = Int($aTestItemData[$r][0]) $aTestItemData[$r][1] = StringReplace($aTestItemData[$r][1], "●", "TRUE") $aTestItemData[$r][9] = StringReplace($aTestItemData[$r][9], "●", "TRUE") Next _ArraySort($aTestItemData, 0, 0, 0, 0) ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") ;~ ;;ConsoleWrite(UBound($aTestItemData) - 1 & @CRLF) $aOriTestItemData = $aTestItemData _UpdateListView() GUICtrlSetData($iFuncSub[1], $rItemCombo, "No.") #EndRegion EndFunc Func _TestItemSelected($rItemRead) ;~ $rItemRead = GUICtrlRead($iFuncSub[1]) If StringCompare($rItemRead, "No.") <> 0 Then _GUICtrlListView_ClickItem($ListViewTbl, $rItemRead-1, "left", False, 2) ; Get selected test item number ;~ $rItemRead = StringLeft(GUICtrlRead($iFuncSub[1]), StringInStr(GUICtrlRead($iFuncSub[1]), " - ")-1) ;~ ;;ConsoleWrite("_" & $rItemRead & "_" & @CRLF) ;~ Local $i = _ArraySearch($aTestItemData, $rItemRead) Local $i = $rItemRead-1 ;need to minus 1 as the row is started with 0 ;~ ;;ConsoleWrite("_" & $i & "_" & @CRLF) GUICtrlSetData($iFuncSub[2], $aTestItemData[$i][3]) GUICtrlSetData($iFuncSub[5], $aTestItemData[$i][4]) GUICtrlSetData($iFuncSub[6], $aTestItemData[$i][5]) GUICtrlSetData($iFuncSub[7], $aTestItemData[$i][6]) GUICtrlSetData($iFuncSub[8], $aTestItemData[$i][7]) ;~ GUICtrlSetData($iFuncSub[9], $aTestItemData[$i][8]) ; Set function/sub selection combo GUICtrlSetState($iFuncSub[3], $GUI_ENABLE) GUICtrlSetData($iFuncSub[3], "") If StringCompare($aTestItemData[$i][2], "") = 0 Then GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, "Select Function/Sub") Else GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, $aTestItemData[$i][2]) EndIf ;;ConsoleWrite($aTestItemData[$i][9] & @CRLF) ; Alan Need to update for multiple board $aReadParamValue = StringSplit($aTestItemData[$i][9], "|") ; Alan Need to update for multiple board ;~ _DebugArrayDisplay($aReadParamValue, "$aReadParamValue") ; Get function/sub parameter and load into array $rFuncSubRead = GUICtrlRead($iFuncSub[3]) $i = _ArraySearch($aFuncSubList, $rFuncSubRead) $aReadParamName = _aReadParamName($i) ;~ _DebugArrayDisplay($aReadParamValue, "$aReadParamValue") ; Set param list view _SetParamInput($aReadParamName, $aReadParamValue) Else _ClearFuncSub() EndIf EndFunc Func _SetParamInput($aParam, $aValue) Local $PrintValue ;~ _DebugArrayDisplay($aParam, "$aParam") ;~ _DebugArrayDisplay($aValue, "$aValue") ;Clear or empty all seeting for param For $r = 1 To 25 GUICtrlSetData($iParam[$r][0], "") GUICtrlSetData($iParam[$r][1], "") GUICtrlSetStyle($iParam[$r][1], BitOR($ES_AUTOHSCROLL, $ES_CENTER)) GUICtrlSetState($iParam[$r][0], $GUI_HIDE) GUICtrlSetState($iParam[$r][1], $GUI_HIDE) GUICtrlSetState($iParam[$r][2], $GUI_HIDE) Next ;Set param label and value For $r = 1 To $aParam[0] If StringCompare($aParam[$r], "") <> 0 Then GUICtrlSetData($iParam[$r][0], $aParam[$r]) GUICtrlSetData($iParam[$r][1], $aValue[$r]) GUICtrlSetState($iParam[$r][0], $GUI_SHOW) GUICtrlSetState($iParam[$r][1], $GUI_SHOW) EndIf Next ;~ ;ConsoleWrite($r & " - " & $aParam[0] & " - " & $aValue[0] & @CRLF) If StringCompare($aParam[1], "") = 0 Then $r = 1 If UBound($aValue) >= $r Then If StringCompare($aValue[$r], "") = 0 Then ;~ $PrintValue = "FALSE" $PrintValue = "TRUE" Else $PrintValue = $aValue[$r] EndIf GUICtrlSetData($iParam[$r][0],"Print Result") GUICtrlSetData($iParam[$r][2], $PrintValue) If StringCompare(GUICtrlRead($iParam[$r][2]), "FALSE") = 0 Then GUICtrlSetColor($iParam[$r][2], $Red) Else GUICtrlSetColor($iParam[$r][2], $Green) EndIf GUICtrlSetState($iParam[$r][0], $GUI_SHOW) GUICtrlSetState($iParam[$r][2], $GUI_SHOW) EndIf Local $hScroll = 21*$r If $hScroll < 220 Then $hScroll = 220 _GUIScrollbars_Generate($hAperture, 0, $hScroll) EndFunc Func _ClearFuncSub() GUICtrlSetData($iFuncSub[1], "") GUICtrlSetData($iFuncSub[1], $rItemCombo, "No.") GUICtrlSetData($iFuncSub[2], "") GUICtrlSetState($iFuncSub[3], $GUI_DISABLE) GUICtrlSetData($iFuncSub[3], "") GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, "Select Function/Sub") For $r = 1 To 25 GUICtrlSetData($iParam[$r][0], "") GUICtrlSetData($iParam[$r][1], "") GUICtrlSetState($iParam[$r][0], $GUI_HIDE) GUICtrlSetState($iParam[$r][1], $GUI_HIDE) GUICtrlSetState($iParam[$r][2], $GUI_HIDE) Next GUICtrlSetData($iFuncSub[5], "") GUICtrlSetData($iFuncSub[6], "") GUICtrlSetData($iFuncSub[7], "") GUICtrlSetData($iFuncSub[8], "") ;~ GUICtrlSetData($iFuncSub[9], "") EndFunc Func _CompareEditItem($Save = 0) Local $ONOFF = 0, $ProgramInfo = 0 Dim $aProgramInfo[1][4] $r = 0 $aProgramInfo[0][0] = "Keys" $aProgramInfo[0][1] = "KeysValue" $aProgramInfo[0][2] = "UpdatedOn" $aProgramInfo[0][3] = "UpdatedBy" If Not IsArray($aProductData) Then Return -1 If StringCompare(GUICtrlRead($InfoTab[1]), $aProductData[_ArraySearch($aProductData, "ModelName")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[1]) & " - " & $aProductData[_ArraySearch($aProductData, "ModelName")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "ModelName" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[1]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[2]), $aProductData[_ArraySearch($aProductData, "ModelDesc")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[2]) & " - " & $aProductData[_ArraySearch($aProductData, "ModelDesc")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "ModelDesc" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[2]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[3]), $aProductData[_ArraySearch($aProductData, "ModelPN")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[3]) & " - " & $aProductData[_ArraySearch($aProductData, "ModelPN")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "ModelPN" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[3]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[4]), $aProductData[_ArraySearch($aProductData, "ModelRev")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[4]) & " - " & $aProductData[_ArraySearch($aProductData, "ModelRev")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "ModelRev" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[4]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[5]), $aProductData[_ArraySearch($aProductData, "FixtureID")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[5]) & " - " & $aProductData[_ArraySearch($aProductData, "FixtureID")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "FixtureID" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[5]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[6]), $aProductData[_ArraySearch($aProductData, "LifeCycle")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[6]) & " - " & $aProductData[_ArraySearch($aProductData, "LifeCycle")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "LifeCycle" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[6]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[7]), $aProductData[_ArraySearch($aProductData, "CurrentCycle")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[7]) & " - " & $aProductData[_ArraySearch($aProductData, "CurrentCycle")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "CurrentCycle" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[7]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[8]), $aProductData[_ArraySearch($aProductData, "UUTQty")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[8]) & " - " & $aProductData[_ArraySearch($aProductData, "UUTQty")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "UUTQty" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[8]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[9]), $aProductData[_ArraySearch($aProductData, "TestStation")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[9]) & " - " & $aProductData[_ArraySearch($aProductData, "TestStation")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "TestStation" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[9]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[10]), $aProductData[_ArraySearch($aProductData, "BarcodeLength")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[10]) & " - " & $aProductData[_ArraySearch($aProductData, "BarcodeLength")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "BarcodeLength" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[10]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(GUICtrlRead($InfoTab[11]), $aProductData[_ArraySearch($aProductData, "BarcodePrefix")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(GUICtrlRead($InfoTab[11]) & " - " & $aProductData[_ArraySearch($aProductData, "BarcodePrefix")][1] & @CRLF) $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "BarcodePrefix" $aProgramInfo[$r][1] = GUICtrlRead($InfoTab[11]) $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(_GetZeroOne(GUICtrlRead($InfoTab[12]), "ON"), $aProductData[_ArraySearch($aProductData, "FlexFlow")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(_GetZeroOne(GUICtrlRead($InfoTab[12]), "ON") & " - " & $aProductData[_ArraySearch($aProductData, "FlexFlow")][1] & @CRLF) If StringCompare(GUICtrlRead($InfoTab[12]), "ON") = 0 Then $ONOFF = 1 Else $ONOFF = 0 EndIf $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "FlexFlow" $aProgramInfo[$r][1] = $ONOFF $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If StringCompare(_GetZeroOne(GUICtrlRead($InfoTab[13]), "ON"), $aProductData[_ArraySearch($aProductData, "StopAtFail")][1]) <> 0 Then $ProgramInfo = 1 ;;ConsoleWrite(_GetZeroOne(GUICtrlRead($InfoTab[13]), "ON") & " - " & $aProductData[_ArraySearch($aProductData, "StopAtFail")][1] & @CRLF) If StringCompare(GUICtrlRead($InfoTab[13]), "ON") = 0 Then $ONOFF = 1 Else $ONOFF = 0 EndIf $r = $r + 1 ReDim $aProgramInfo[$r+1][4] $aProgramInfo[$r][0] = "StopAtFail" $aProgramInfo[$r][1] = $ONOFF $aProgramInfo[$r][2] = _NowCalc() $aProgramInfo[$r][3] = $flexATSUser EndIf If $ProgramInfo = 1 And $Save = 0 Then $SaveChange = MsgBox($MB_YESNO, "FlexATS", "Test Program Information Has been Change..." & @CRLF & "Do you want to save changes?") If $SaveChange = 6 Then ;~ _DebugArrayDisplay($aProgramInfo) _SaveProductInfo($aProgramInfo) $aProductData = _ParserDataToArray($GetProgramPath, $MDBPassword, "Product Information") StatusWrite("Product Information Saved...") Else _LoadProgramData($GetProgramPath) StatusWrite("Product Information Saved...") EndIf ElseIf $Save = 1 Then _SaveProductInfo($aProgramInfo) $aProductData = _ParserDataToArray($GetProgramPath, $MDBPassword, "Product Information") StatusWrite("Product Information Saved...") EndIf EndFunc Func _SetONOFF($hWID, $Data1, $Data2) If StringCompare($Data1, $Data2) = 0 Then GUICtrlSetData($hWID, "OFF") GUICtrlSetColor($hWID, $White) GUICtrlSetBkColor($hWID, $Red) ;~ GUICtrlSetFont($hWID, 9);, $FW_SEMIBOLD ) Else GUICtrlSetData($hWID, "ON") GUICtrlSetColor($hWID, $Black) GUICtrlSetBkColor($hWID, $Green) ;~ GUICtrlSetFont($hWID, 9);, $FW_SEMIBOLD ) EndIf EndFunc Func _SaveProductInfo($readArray) ;~ _DebugArrayDisplay($readArray, "$readArray") If UBound($readArray) > 1 Then $UpdateRtn = _AddArrayData($GetProgramPath, $MDBPassword, "Product Information", $readArray, "Keys") EndIf ;~ $ScriptChange = 0 EndFunc Func _SaveFuncParam() Local $rParam $r = GUICtrlRead($iFuncSub[1])-1 $aTestItemData[$r][0] = GUICtrlRead($iFuncSub[1]) $aTestItemData[$r][1] = "FALSE" If _GUICtrlListView_GetItemChecked($ListViewTbl, $aTestItemData[$r][0]-1) = True Then $aTestItemData[$r][1] = "TRUE" $aTestItemData[$r][2] = GUICtrlRead($iFuncSub[3]) $aTestItemData[$r][3] = GUICtrlRead($iFuncSub[2]) $aTestItemData[$r][4] = GUICtrlRead($iFuncSub[5]) $aTestItemData[$r][5] = GUICtrlRead($iFuncSub[6]) $aTestItemData[$r][6] = GUICtrlRead($iFuncSub[7]) $aTestItemData[$r][7] = GUICtrlRead($iFuncSub[8]) ;~ $aTestItemData[$r][8] = GUICtrlRead($iFuncSub[9]) $aTestItemData[$r][9] = _ReadParam($r) $aTestItemData[$r][10] = _NowCalc() $aTestItemData[$r][11] = $flexATSUser ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") ;~ _UpdateListView() ;~ _SaveTestItem() EndFunc Func _ReadParam($Row) Local $rParam = -1 ; read parameter data Local $i = _ArraySearch($aFuncSubList, $aTestItemData[$Row][2]) If Not @error Then ;~ ;ConsoleWrite($aFuncSubList[$i][0] & @CRLF) $aParamNo = StringSplit(StringTrimRight(StringReplace(_ArrayToString($aFuncSubList, "|", $i, $i, @CRLF, 1), "||", ""), 1), "|") $rParam = GUICtrlRead($iParam[1][1]) ;~ ;ConsoleWrite(GUICtrlRead($iParam[1][0]) & " - " & $rParam & @CRLF) If StringCompare(GUICtrlRead($iParam[1][0]), "Print Result") <> 0 Then For $r = 2 To $aParamNo[0] $rParam = $rParam & "|" & GUICtrlRead($iParam[$r][1]) Next $rParam = $rParam & "|" & GUICtrlRead($iParam[$r][2]) & "|" & $aTestItemData[$Row][2] Else $rParam = GUICtrlRead($iParam[1][2]) & "|" & $aTestItemData[$Row][2] EndIf EndIf ;~ ;ConsoleWrite($rParam & @CRLF) Return $rParam EndFunc Func _ReloadVBScript() $oScriptControl = ObjCreate("ScriptControl") If @error Then MsgBox($MB_SYSTEMMODAL, $GUITitle, "MSScriptControl.ScriptControl" & @CRLF & "Error Getting an active MSScriptControl.ScriptControl Object. Error code: " & Hex(@error, 8)) Exit EndIf $FileName = $aProductData[_ArraySearch($aProductData, "TestStationName")][1] $ReadFile = _ParserDataToArray($GetProgramPath, $MDBPassword, "[Test Program]", "[Attachment]", "[Filename] = '" & $FileName & "'") Local $VBsFile = @ScriptDir & "\TempTestProgram.vbs" ; Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($VBsFile, 10) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") FileWrite($hFileOpen, BinaryToString($ReadFile[0][0])) FileClose($hFileOpen) If FileExists($VBsFile) Then $aFuncSubList = _LoadVBScript($VBsFile) ; Load into Function/Sub Select Combo GUICtrlSetData($iFuncSub[3], "") $rFuncSubCombo = "Select Function/Sub" For $r = 1 To UBound($aFuncSubList) -1 $rFuncSubCombo = $rFuncSubCombo & "|" & $aFuncSubList[$r][0] Next GUICtrlSetData($iFuncSub[3], $rFuncSubCombo, "Select Function/Sub") Else MsgBox($MB_SYSTEMMODAL, "flexATS", "VB Script file not found...") EndIf EndFunc Func _DisableAllBtn($GUIState = $GUI_DISABLE) ; Menu Items GUICtrlSetState($MenuFile[0], $GUIState) ; File GUICtrlSetState($MenuEdit[0], $GUIState) ; Edit GUICtrlSetState($MenuOpt[0], $GUIState) ; Option GUICtrlSetState($MenuHelp[0], $GUIState) ; Help ; Toolbar Button For $r = 1 To 9 GUICtrlSetState($ToolsBtn[$r], $GUIState) Next GUICtrlSetState($ToolsBtn[13], $GUIState) ; GUI Tab GUISetState(@SW_HIDE, $hAperture) If GUICtrlGetState($GUITab[1]) <> $GUI_SHOW Then GUICtrlSetState($GUITab[1], $GUI_SHOW) EndIf GUICtrlSetState($GUITab[0], $GUIState) ; Tab Input For $r = 1 To 4 GUICtrlSetState($InfoTab[$r], $GUIState) Next EndFunc Func _SaveTestProgram() ;ConsoleWrite("_SaveTestProgram() = " & $ScriptChange & @CRLF) If $ScriptChange = 1 Then ; Make sure there are change on test script before save $FileName = $aProductData[_ArraySearch($aProductData, "TestStationName")][1] _UpdateData($GetProgramPath, $MDBPassword, "[Test Program]", "[Filename]='" & $FileName & "_Backup'", "[Filename]='" & $FileName & "'") Local $hFile = FileOpen(@ScriptDir & "\TempTestProgram.vbs") Local $dBinaryData = StringToBinary(FileRead($hFile), $SB_UTF16LE) FileClose($hFile) Dim $aTPFields[2][4] = [["Filename", "Attachment", "UpdatedOn", "UpdatedBy"], _ [$FileName, $dBinaryData, _NowCalc(), $flexATSUser]] _AddArrayData($GetProgramPath, $MDBPassword, "[Test Program]", $aTPFields, "Filename") ;~ MsgBox(0, "", "_SaveTestProgram()" & @CRLF) EndIf $ScriptChange = 0 EndFunc Func _SaveTestItem() _FixRowNo_Date() ;~ $UUTNo = GUICtrlRead($iFuncSub[4]) $aTIFields = _TestItemTableData() _ClearListViewResult() ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") _ArrayConcatenate($aTIFields, $aTestItemData) ;~ _DebugArrayDisplay($aTIFields, "$aTIFields") $Table = _MDBCreateTable($GetProgramPath, $MDBPassword, "Test Items", $aTIFields, "", "FuncSubParam", "UpdatedOn", "RowNo") ;~ _DebugArrayDisplay($aTIFields, "$aTIFields") _AddArrayData($GetProgramPath, $MDBPassword, "Test Items", $aTIFields, "RowNo") EndFunc Func _UpdateListView() ;~ GUICtrlSetData($iFuncSub[1], "") _GUICtrlListView_DeleteAllItems($ListViewTbl) $rItemCombo = "No." For $r = 0 To UBound($aTestItemData) - 1 $rItemCombo = $rItemCombo & "|" & $r + 1; & " - " & $aTestItemData[$r][3] _GUICtrlListView_AddItem($ListViewTbl, $aTestItemData[$r][0]) ; NO _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][2], 1) ; FuncSub If StringCompare($aTestItemData[$r][3], "") = 0 Then $aTestItemData[$r][3] = $aTestItemData[$r][2] _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][3], 2) ; Test Items Name _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][4], 3) ; Low Limit _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][5], 4) ; Upper Limit _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][6], 5) ; Unit _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][7], 8) ; Retest Time ;~ _GUICtrlListView_AddSubItem($ListViewTbl, $r, $aTestItemData[$r][8], 9) ; Fail Goto If StringCompare($aTestItemData[$r][1], "TRUE") = 0 Then _GUICtrlListView_SetItemChecked($ListViewTbl, $r) If StringCompare($aTestItemData[$r][1], "●") = 0 Then _GUICtrlListView_SetItemChecked($ListViewTbl, $r) Next ;~ _GUICtrlListView_AddArray _ClearFuncSub() ;_UpdateListViewHandler() EndFunc Func _ClearListViewResult() For $r = 0 To UBound($aTestItemData) - 1 $aTestItemData[$r][1] = _GUICtrlListView_GetItemChecked($ListViewTbl, $r) _GUICtrlListView_AddSubItem($ListViewTbl, $r, "", 6) ; Unit _GUICtrlListView_AddSubItem($ListViewTbl, $r, "", 7) ; Retest Time If $ScriptChange = 0 Then If UBound($aOriTestItemData) = UBound($aTestItemData) Then If StringCompare($aOriTestItemData[$r][1], $aTestItemData[$r][1]) <> 0 Then $ScriptChange = 1 Else $ScriptChange = 1 EndIf EndIf Next EndFunc Func _ArrayClearRow($Row) For $c = 1 To UBound($aTestItemData, 2)-1 $aTestItemData[$Row][$c] = "" Next EndFunc Func _ArrayGetData($Row) Local $Rtn[UBound($aTestItemData, 2)] For $c = 1 To UBound($aTestItemData, 2)-1 $Rtn[$c] = $aTestItemData[$Row][$c] Next Return $Rtn EndFunc Func _ArrayInsertData($Row, $aData) For $c = 1 To UBound($aTestItemData, 2)-1 If UBound($aTestItemData, 2) <> UBound($aData) Then ExitLoop $aTestItemData[$Row][$c] = $aData[$c] Next EndFunc Func _FixRowNo_Date() For $No = 0 To UBound($aTestItemData)-1 $aTestItemData[$No][0] = $No+1 $aTestItemData[$No][UBound($aTestItemData, 2)-2] = _NowCalc() ; last 2nd column is Date & Time Next ;~ _DebugArrayDisplay($aTestItemData, "$aTestItemData") EndFunc Func StatusWrite($sMessage) ; Write status or action log message into Status Bar GUICtrlSetData($Status[1], "") GUICtrlSetData($Status[1], " " & $sMessage) EndFunc Func DateTime() If StringCompare(GUICtrlRead($Status[2]), _NowCalc()) <> 0 Then GUICtrlSetData($Status[2], _NowCalc()) EndIf EndFunc Func _UUTNoCombo() $Rtn = "" For $i = 1 To $UUTMax $Rtn &= $i &"|" Next ;ConsoleWrite($Rtn & @CRLF) Return $Rtn EndFunc ; use _SetItemParam() with defaults to set off ; to mark an SubItem as set, 2^SubItem-index are stored in ItemParam as sum for all SubItem, ; so the max. count of columns are 31 !! Func _SetItemParam($hWnd, $iItem, $iSubItem, $iBkCol=-1, $iCol=-1, $iSize=-1, $iWeight=-1, $sFont=-1) Local $accArray, $sumParam = 0 ;ConsoleWrite("_SetItemParam>>" & $iItem & " - " & $iSubItem & @CRLF) For $i = 0 To UBound($ahWndSets) -1 If $ahWndSets[$i][0] = $hWnd Then $accArray = $ahWndSets[$i][1] ; temp array ExitLoop EndIf Next If $iBkCol = -1 Then $iBkCol = $defBkColLV $sumParam += 1 EndIf If $iCol = -1 Then $iCol = $defColLV $sumParam += 1 EndIf If $iSize = -1 Then $iSize = 14 $sumParam += 1 EndIf If $iWeight = -1 Then $iWeight = 400 $sumParam += 1 EndIf If $sFont = -1 Then $sFont = 'Arial' $sumParam += 1 EndIf $accArray[$iItem][$iSubItem][0] = $iBkCol $accArray[$iItem][$iSubItem][1] = $iCol $accArray[$iItem][$iSubItem][2] = $iSize $accArray[$iItem][$iSubItem][3] = $iWeight $accArray[$iItem][$iSubItem][4] = $sFont $ahWndSets[$i][1] = $accArray ; write back to original array ; if SubItem not registered in IParam OR all values by -1 (delete Sub from IParam) ==> switch Sub value in IParam If ( Not BitAND(__GUICtrlListView_GetItemParam($hWnd, $iItem), 2^$iSubItem) ) Or ( $sumParam = 5 ) Then _ __GUICtrlListView_SetItemParam($hWnd, $iItem, BitXOR(__GUICtrlListView_GetItemParam($hWnd, $iItem), 2^$iSubItem)) If BitAND(__GUICtrlListView_GetItemParam($hWnd, $iItem), 2^$iSubItem) Then _WinAPI_InvalidateRect($hWnd) ; only if values changed EndFunc ;==>_SetItemParam Func __GUICtrlListView_GetItemParam($hWnd, $iItem) ; modified for use indexshift Local $param = _GUICtrlListView_GetItemParam($hWnd, $iItem) If $param > 0 Then $param -= $INDEXSHIFT Return $param EndFunc Func __GUICtrlListView_SetItemParam($hWnd, $iItem, $iParam) ; modified for use indexshift _GUICtrlListView_SetItemParam($hWnd, $iItem, $INDEXSHIFT + $iParam) EndFunc Func _DrawItemCol(ByRef $hDC, ByRef $tCustDraw, $hWnd, $iItem, $iSubitem) Local $accArray For $i = 0 To UBound($ahWndSets) -1 If $ahWndSets[$i][0] = $hWnd Then $accArray = $ahWndSets[$i][1] ExitLoop EndIf Next Local $aDefFont[14] = [14,0,0,0,$FW_NORMAL,False,False,False, _ $DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS,$CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial'] $aDefFont[0] = $accArray[$iItem][$iSubItem][2] $aDefFont[4] = $accArray[$iItem][$iSubItem][3] $aDefFont[13] = $accArray[$iItem][$iSubItem][4] $hDC = DllStructGetData($tCustDraw, 'hdc') DllStructSetData($tCustDraw, 'clrText', RGB2BGR($accArray[$iItem][$iSubItem][1])) DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($accArray[$iItem][$iSubItem][0])) $hFont = _WinAPI_CreateFont($aDefFont[0],$aDefFont[1],$aDefFont[2],$aDefFont[3],$aDefFont[4],$aDefFont[5],$aDefFont[6], _ $aDefFont[7],$aDefFont[8],$aDefFont[9],$aDefFont[10],$aDefFont[11],$aDefFont[12],$aDefFont[13]) _WinAPI_SelectObject($hDC, $hFont) EndFunc ;==>_DrawItemCol Func _DrawDefault(ByRef $hDC, ByRef $tCustDraw) ; draw unformatted item $hDC = DllStructGetData($tCustDraw, 'hdc') DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV)) DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV)) $hFont = _WinAPI_CreateFont(14,0,0,0,$FW_NORMAL,False,False,False,$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, _ $CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial') _WinAPI_SelectObject($hDC, $hFont) EndFunc ;==>_DrawDefault Func RGB2BGR($iColor) Local $sH = Hex($iColor,6) Return '0x' & StringRight($sH, 2) & StringMid($sH,3,2) & StringLeft($sH, 2) EndFunc ;==>RGB2BGR Func _UpdateListViewHandler() ReDim $aLV1[_GUICtrlListView_GetItemCount($hListView)][_GUICtrlListView_GetColumnCount($hListView)][5] ; create array to hold ListView-handle and accordingly array $ahWndSets[0][0] = $hListView $ahWndSets[0][1] = $aLV1 EndFunc ; User access setup Func _UserAccessSetting($AccessRight) Switch $AccessRight Case 4 _DisableAllBtn() GUICtrlSetState($ToolsBtn[13], $GUI_ENABLE) GUICtrlSetState($ToolsBtn[2], $GUI_ENABLE) ; Toolbar Button For $r = 1 To 9 If $r <> 2 Then GUICtrlSetImage($ToolsBtn[$r], $ToolsIco[$r+13]) Next ;GUICtrlSetImage($ToolsBtn[13], $ToolsIco[26]) EndSwitch EndFunc Attach is the main page code, thanks for the help in advance.
  2. To all Professional developer, hope someone can help me on this issues. i developed GUI where it will load some program/function from VBscript (with MSScriptcontrol), it run normally at start without any issues. but after few run all the ctrl disappear. attached the GUI below, can someone help advice? what are the issues
  3. i wanted to have a open function, where i can edit it when there are change. the main script will call the function from an editable .au3 file.
  4. @pedrit0 have you get this to work? i'm looking for similar things for days now. i would like someting like MSScriptContol where you can reload updated script/function and then call it in your main exe.
  5. add Opt("GUICloseOnESC", 0) on the beginning of your script to prevent "ESC" press exiting GUI.
  6. Hi Alanchinese, Have you found a solution to this problem?
  7. unable to download.. please help provide zipped file. thank
  8. additional info. for the $RelaySN. please use the software provide by USB device the check it. click find device and u will get the Serial Number.
  9. Sorry guys for late reply, be busy with work lately. hope below code still help. Func _RelayOn($Port="01") Local $dll = DllOpen(@ScriptDir&"usb_relay_device.dll") If $dll = -1 Then MsgBox(48,"","Dll Open error") Local $result = DllCall($dll, "int", "usb_relay_init") If @error Then MsgBox(48,"","init error") ;_ArrayDisplay($result) $aRet = DllCall( $dll, "int:cdecl", "usb_relay_device_open_with_serial_number", "str", $RelaySN, "uint", 5 ) If @error Then ConsoleWrite( "Errorcode: " & @error & @CRLF ) SetError(@error) Else ConsoleWrite( "Handle: " & $aRet[0] & @CRLF ) $return = DllCall($dll, "int:cdecl", "usb_relay_device_open_one_relay_channel","int",$aRet[0],"int",$Port) If @error Then ConsoleWrite( "Errorcode Open: " & @error & @CRLF ) DllCall($dll, "int:cdecl", "usb_relay_device_close","int",$aRet[0]) EndIf DllClose($dll) EndFunc Func _RelayOff($Port="01") Local $dll = DllOpen(@ScriptDir&"usb_relay_device.dll") If $dll = -1 Then MsgBox(48,"","Dll Open error") Local $result = DllCall($dll, "int", "usb_relay_init") If @error Then MsgBox(48,"","init error") ;_ArrayDisplay($result) $aRet = DllCall( $dll, "int:cdecl", "usb_relay_device_open_with_serial_number", "str", $RelaySN, "uint", 5 ) If @error Then ConsoleWrite( "Errorcode: " & @error & @CRLF ) SetError(@error) Else ConsoleWrite( "Handle: " & $aRet[0] & @CRLF ) $return = DllCall($dll, "int:cdecl", "usb_relay_device_close_one_relay_channel","int",$aRet[0],"int",$Port) If @error Then ConsoleWrite( "Errorcode Close: " & @error & @CRLF ) ;_ArrayDisplay($return) DllCall($dll, "int:cdecl", "usb_relay_device_close","int",$aRet[0]) EndIf DllClose($dll) EndFunc
  10. Hi Guys, this tread may be a little old but i still need to ask. has been google for hours. i m building my own backup software for my data. in the GUI window an icon is place but i cannot get the background of the icon goes transparent. has this problem been solve? my code: Func Main() Local $msg $Main = GUICreate("Smart Sync",450,360) ;GUISetBkColor(0xFFFFFF) GUICtrlSetDefBkColor($GUI_BKCOLOR_TRANSPARENT) GUICtrlCreatePic(@ScriptDir&"ImageBlue White.bmp",0,0,450,400) GUICtrlSetState(-1,$GUI_DISABLE) GUICtrlCreateLabel("My Computer"&@CRLF&@ComputerName,50,35,100,60,$SS_CENTER);,BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1,13,500) GUICtrlSetColor(-1, 0x974807) $HomeDrive = GUICtrlCreateProgress(60,75,80,200,BitOR($PBS_VERTICAL,$PBS_SMOOTH)) $ProgressLabel1 = GUICtrlCreateLabel("",60,75,80,200,BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor($ProgressLabel1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($ProgressLabel1,13,500) GUICtrlSetColor($ProgressLabel1, 0x974807) $Free = DriveSpaceFree($SourceDir) $Total = DriveSpaceTotal($SourceDir) $Size = 100-(($Free/$Total)*100) GUICtrlSetData($HomeDrive,$Size) GUICtrlSetData($ProgressLabel1,Round($Size)) $SourceBtn = GUICtrlCreateButton("Browse",50,285,100,30) $BackUpLabel = GUICtrlCreateLabel("My Backup Drive"&@CRLF&$BackupDisk,280,35,140,60,$SS_CENTER);,BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1,13,500) GUICtrlSetColor(-1, 0x974807) $BackDrive = GUICtrlCreateProgress(310, 75, 80, 200,BitOR($PBS_VERTICAL,$PBS_SMOOTH)) $ProgressLabel2 = GUICtrlCreateLabel("",310,75,80,200,BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor($ProgressLabel2, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($ProgressLabel2,13,500) GUICtrlSetColor($ProgressLabel2, 0x974807) $Free = DriveSpaceFree($BackupDisk) $Total = DriveSpaceTotal($BackupDisk) $Size = 100-(($Free/$Total)*100) GUICtrlSetData($BackDrive,$Size) $DestBtn = GUICtrlCreateButton("Browse",300,285,100,30) $SyncBtn = GUICtrlCreateIcon(@ScriptDir&"ImageSync_Green.ico",-1,181,131,88,88,BitOR($GUI_SS_DEFAULT_ICON,$SS_CENTERIMAGE)) ;$SyncBtn = GUICtrlCreatePic(@ScriptDir&"ImageSync_Green.png",-1,181,131,88,88,$GUI_SS_DEFAULT_ICON) ;GUICtrlSetBkColor($SyncBtn,$GUI_BKCOLOR_TRANSPARENT) ;GUIRegisterMsg(0x000F, "WM_PAINT") $Setting = TrayCreateItem("Setting") $About = TrayCreateItem("About") TrayCreateItem("") $Exit = TrayCreateItem("Exit") TraySetState() GUISetState() $List = _DriveList() ; Run the GUI until the dialog is closed While 1 Switch TrayGetMsg() Case $Exit ExitLoop Case $About MsgBox(64,"About","Smart Sync)"&@LF&@LF&"Software Ver. "&$Version&@LF& _ "Copyright © 2013 Alan Kam"&@LF&"AlTech Soft",5) Case $Setting GUISetState(@SW_SHOW,$Main) EndSwitch Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ;GUISetState(@SW_HIDE,$Main) ExitLoop Case $GUI_EVENT_MINIMIZE GUISetState(@SW_MINIMIZE,$Main) Case $SyncBtn GUICtrlSetImage($SyncBtn,@ScriptDir&"ImageSync_Silver.ico") If StringCompare($DriveRtv[0],"Not Found") <> 0 Then _FileProcess($SourceDir,$DriveRtv[0]&$DriveRtv[1]&"") EndIf Case $SourceBtn Case $DestBtn EndSwitch Switch _DriveList() Case $List ;MsgBox(0,"","New Drive") Case Else $List = _DriveList() If $List <> $New Then $New = _DriveList() ;MsgBox(0,"","New Drive") GUISetState(@SW_SHOW,$Main) $DriveRtv = _BackupDriveSearch() $BackupDisk = $DriveRtv[0] GUICtrlSetData($BackUpLabel,"My Backup Drive"&@CRLF&$BackupDisk) GUICtrlSetData($DestBtn,$BackupDisk) $Free = DriveSpaceFree($BackupDisk) $Total = DriveSpaceTotal($BackupDisk) $Size = 100-(($Free/$Total)*100) GUICtrlSetData($BackDrive,$Size) EndIf EndSwitch WEnd GUIDelete() EndFunc
  11. Hi Lars, Thank you very much for the help and info on the dll. i learn some new thing about DllCall here. Thank Alan
  12. Hi LarsJ, Thank you very much for the help. it working now.
×
×
  • Create New...