mucitbey Posted October 15, 2019 Share Posted October 15, 2019 (edited) Hello, I would like to print the data in the txt file into the inputboxes in the GUI in sequence (as in the example image) and use that data separately for the query. Can you share examples that can guide me on this.Thank you all in advance. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("_mucitbey_", 430, 500, -1, -1) $import = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) $export = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) $In1 = GUICtrlCreateInput("001", 10, 60, 30, 20) $In2 = GUICtrlCreateInput("00000024", 45, 60, 70, 20) $In3 = GUICtrlCreateInput("0", 120, 60, 30, 20) $In4 = GUICtrlCreateInput("1.10.2019", 155, 60, 70, 20) $In5 = GUICtrlCreateInput("09:37:53", 230, 60, 60, 20) $In6 = GUICtrlCreateInput("", 295, 60, 120, 20) $In1 = GUICtrlCreateInput("001", 10, 85, 30, 20) $In2 = GUICtrlCreateInput("00000039", 45, 85, 70, 20) $In3 = GUICtrlCreateInput("0", 120, 85, 30, 20) $In4 = GUICtrlCreateInput("1.10.2019", 155, 85, 70, 20) $In5 = GUICtrlCreateInput("10:29:10", 230, 85, 60, 20) $In6 = GUICtrlCreateInput("", 295, 85, 120, 20) $Lb1 = GUICtrlCreateLabel("#", 20, 40, 30, 20) $Lb2 = GUICtrlCreateLabel("Card ID", 50, 40, 36, 20) $Lb3 = GUICtrlCreateLabel("[]", 130, 40, 36, 20) $Lb4 = GUICtrlCreateLabel("Date", 160, 40, 36, 20) $Lb5 = GUICtrlCreateLabel("Clock", 240, 40, 36, 20) $Lb6 = GUICtrlCreateLabel("User", 300, 40, 36, 20) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd 20191015.txt 001,00000024,0,1.10.2019 09:37:53 001,00000039,0,1.10.2019 10:29:10 001,00000036,0,1.10.2019 10:29:30 001,00000016,0,1.10.2019 10:29:39 001,00000014,0,1.10.2019 14:32:49 Edited October 15, 2019 by mucitbey Link to comment Share on other sites More sharing options...
water Posted October 15, 2019 Share Posted October 15, 2019 (edited) Part 1: Creating the GUI. The script creates as many rows as are needed to hold the content of the file. The IDs of the controls are stored in an array. #include <GUIConstantsEx.au3> #include <File.au3> Global $aInFile, $aTemp, $iGUIFirstRow = 60, $iSpaceTonextRow = 23, $iNumberOfColumns = 6 _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT) Global $iLines = UBound($aInFile) Global $aGUI[$iLines][$iNumberOfColumns] GUICreate("_mucitbey_", 430, 500, -1, -1) GUICtrlCreateLabel("#", 20, 40, 30, 20) GUICtrlCreateLabel("Card ID", 50, 40, 36, 20) GUICtrlCreateLabel("[]", 130, 40, 36, 20) GUICtrlCreateLabel("Date", 160, 40, 36, 20) GUICtrlCreateLabel("Clock", 240, 40, 36, 20) GUICtrlCreateLabel("User", 300, 40, 36, 20) Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) For $i = 0 To $iLines - 1 $aTemp = StringSplit($aInFile[$i], ", ", $STR_NOCOUNT) ReDim $aTemp[$iNumberOfColumns] $aGUI[$i][0] = GUICtrlCreateInput($aTemp[0], 10, $iGUIFirstRow + ($iSpaceTonextRow * $i), 30, 20) $aGUI[$i][1] = GUICtrlCreateInput($aTemp[1], 45, $iGUIFirstRow + ($iSpaceTonextRow * $i), 70, 20) $aGUI[$i][2] = GUICtrlCreateInput($aTemp[2], 120, $iGUIFirstRow + ($iSpaceTonextRow * $i), 30, 20) $aGUI[$i][3] = GUICtrlCreateInput($aTemp[3], 155, $iGUIFirstRow + ($iSpaceTonextRow * $i), 70, 20) $aGUI[$i][4] = GUICtrlCreateInput($aTemp[4], 230, $iGUIFirstRow + ($iSpaceTonextRow * $i), 60, 20) $aGUI[$i][5] = GUICtrlCreateInput($aTemp[5], 295, $iGUIFirstRow + ($iSpaceTonextRow * $i), 120, 20) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited October 15, 2019 by water Fixed bugs Pixelsearch described below mucitbey and pixelsearch 2 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
pixelsearch Posted October 15, 2019 Share Posted October 15, 2019 (edited) @water: Instead of : Global $aGUI[$iLines][$iSpaceTonextRow] Shouldn't it be (?) Global $aGUI[$iLines][$iNumberOfColumns] Sure there is something I didn't understand, as there is also this (?) ReDim $aTemp[$iSpaceTonextRow] Edited October 15, 2019 by pixelsearch mucitbey 1 Link to comment Share on other sites More sharing options...
water Posted October 15, 2019 Share Posted October 15, 2019 Thanks for the heads up! That was a find&replace problem My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mucitbey Posted October 15, 2019 Author Share Posted October 15, 2019 Endless thanks to both of you for your help "water" and "pixelsearch".I'm going to need some help for the second stage, and I'll probably need your help again. But let me work first, then help.Thank you again. Link to comment Share on other sites More sharing options...
water Posted October 15, 2019 Share Posted October 15, 2019 Seems you need to limit the number of records you can display on a single page My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Zedna Posted October 16, 2019 Share Posted October 16, 2019 Better is to use ListView in this case (instead of array of Input controls). Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mucitbey Posted October 18, 2019 Author Share Posted October 18, 2019 There are two other things I want to do in GUI.1. Using the "CHECK USER" button, compare the numbers in the "Card ID" column with the names in the "User.ini" file and write the value to the user section.2. Change the color of the values in the time column between 08:10:00 and 16:50:00 with the help of a button.I've done this with Excell before. But I want to do it in Autoit (since I am a beginner in this language).Endless thanks to all of you for your help and guidance. User.txt 00000001=Micheal DUNCAN 00000002=Jhon ROCK 00000003=Abbie VIvIAN 00000004= . . . Link to comment Share on other sites More sharing options...
mucitbey Posted October 18, 2019 Author Share Posted October 18, 2019 On 10/15/2019 at 3:29 PM, water said: Seems you need to limit the number of records you can display on a single page I am aware of my mistakes and shortcomings, I am trying to improve myself with your advice.Please do not spare us your suggestions and suggestions. Thanks Link to comment Share on other sites More sharing options...
mucitbey Posted October 18, 2019 Author Share Posted October 18, 2019 On 10/16/2019 at 1:31 PM, Zedna said: Better is to use ListView in this case (instead of array of Input controls). I was unable to get the data as a variable in ListView, I would like to try it if you have a code suggestion but a suggestion. Thank Link to comment Share on other sites More sharing options...
water Posted October 18, 2019 Share Posted October 18, 2019 2 hours ago, mucitbey said: 1. Using the "CHECK USER" button, compare the numbers in the "Card ID" column with the names in the "User.ini" file and write the value to the user section. Use _FileReadToArray with $sDelimiter set to "=" and you will get a 2d array. Loop through $aGUI and compare column 2 with the array (column 2) derived from the text file. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Zedna Posted October 18, 2019 Share Posted October 18, 2019 #include <GUIConstantsEx.au3> #include <File.au3> Global $aInFile _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT) Global $iLines = UBound($aInFile) GUICreate("_mucitbey_", 430, 500, -1, -1) $lv = GUICtrlCreateListView("#|Card ID|[]|Date|Clock|User", 10, 60, 400, 400) Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) For $i = 0 To $iLines - 1 $aTemp = StringSplit($aInFile[$i], ", ", $STR_NOCOUNT) GUICtrlCreateListViewItem($aTemp[0] & "|" & $aTemp[1] & "|" & $aTemp[2] & "|" & $aTemp[3] & "|" & $aTemp[4] & "|", $lv) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd pixelsearch 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mucitbey Posted October 18, 2019 Author Share Posted October 18, 2019 When I was in school, Array had always been the subject of my challenge. I'm doing something wrong, but what? #include <GUIConstantsEx.au3> #include <File.au3> Global $aInFile _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT) Global $iLines = UBound($aInFile) Global $bFile _FileReadToArray("Users.txt", $bFile, $FRTA_NOCOUNT) Global $uLines = UBound($bFile) GUICreate("_mucitbey_", 430, 500, -1, -1) $lv = GUICtrlCreateListView("#|Card ID|[]|Date|Clock|User", 10, 60, 400, 400) ;Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) ;Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) For $i = 0 To $iLines - 1 $aTemp = StringSplit($aInFile[$i], ", ", $STR_NOCOUNT) GUICtrlCreateListViewItem($aTemp[0] & "|" & $aTemp[1] & "|" & $aTemp[2] & "|" & $aTemp[3] & "|" & $aTemp[4] & "|", $lv) Next For $i = 0 To $uLines - 1 $bTemp = StringSplit($bFile[$i], "= ", 2) GUICtrlRead ($bTemp[0]& $bTemp[1]) If $aTemp[1] == $bTemp[0] Then $aTemp[4] = $bTemp[1] Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Zedna Posted October 18, 2019 Share Posted October 18, 2019 expandcollapse popup#include <GUIConstantsEx.au3> #include <File.au3> Global $aInFile _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT) Global $iLines = UBound($aInFile) Global $bFile = @CRLF & FileRead("Users.txt") & @CRLF GUICreate("_mucitbey_", 430, 500, -1, -1) $lv = GUICtrlCreateListView("#|Card ID|[]|Date|Clock|User", 10, 60, 400, 400) ;~ Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) ;~ Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) For $i = 0 To $iLines - 1 $aTemp = StringSplit($aInFile[$i], ", ", $STR_NOCOUNT) $user = GetUser($aTemp[1]) GUICtrlCreateListViewItem($aTemp[0] & "|" & $aTemp[1] & "|" & $aTemp[2] & "|" & $aTemp[3] & "|" & $aTemp[4] & "|" & $user, $lv) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func GetUser($ID) Local $i, $j, $len $i = StringInStr($bFile, @CRLF & $ID & '=', 1, 1) If $i = 0 Then Return '' $j = StringInStr($bFile, @CRLF, 1, 1, $i+1) If $j = 0 Then Return '' $len = StringLen(@CRLF & $ID & '=') Return StringMid($bFile, $i+$len, $j-$i-$len) EndFunc mucitbey 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
pixelsearch Posted October 18, 2019 Share Posted October 18, 2019 (edited) Unknow ID 14 on purpose : expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Global $aInFile _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT) Global $iLines = UBound($aInFile) ; _ArrayDisplay($aInFile, "$aInFile") Global $bFile _FileReadToArray("Users.txt", $bFile, $FRTA_NOCOUNT, "=") ; _ArrayDisplay($bFile, "$bFile") GUICreate("_mucitbey_", 430, 500, -1, -1) $lv = GUICtrlCreateListView("#|Card ID|[]|Date|Clock|User", 10, 60, 400, 400) ;Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) ;Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) $nBegin = TimerInit() For $i = 0 To $iLines - 1 $aTemp = StringSplit($aInFile[$i], ", ", $STR_NOCOUNT) $iIndex = _ArraySearch($bFile, $aTemp[1], 0, 0, 0, 0, 1, 0) ; search only col. 0 ; $iIndex = _ArrayBinarySearch($bFile, $aTemp[1], 0, 0, 0) ; use only if "Users.txt" is sorted $user = (($iIndex <> -1) ? ($bFile[$iIndex][1]) : ("Unknown ID")) GUICtrlCreateListViewItem($aTemp[0] & "|" & $aTemp[1] & "|" & $aTemp[2] & "|" & _ $aTemp[3] & "|" & $aTemp[4] & "|" & $user, $lv) Next ConsoleWrite(TimerDiff($nBegin) & @CRLF) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited October 19, 2019 by pixelsearch reworked code a bit (no more Func, comment both _ArrayDisplay) mucitbey 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted October 18, 2019 Share Posted October 18, 2019 (edited) Another way to do it, working directly on 2D Array $aInFile (no more need for Array $aTemp or StringSplit) expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Global $aInFile _FileReadToArray("20191015.txt", $aInFile, $FRTA_NOCOUNT, ", ") Global $iLines = UBound($aInFile) ; _ArrayDisplay($aInFile, "$aInFile") Global $bFile _FileReadToArray("Users.txt", $bFile, $FRTA_NOCOUNT, "=") ; _ArrayDisplay($bFile, "$bFile") GUICreate("_mucitbey_", 430, 500, -1, -1) $lv = GUICtrlCreateListView("#|Card ID|[]|Date|Clock|User", 10, 60, 400, 400) ;Global $hImport = GUICtrlCreateButton("TXT IMPORT", 10, 10, 75, 20) ;Global $hExport = GUICtrlCreateButton("PDF EXPORT", 330, 10, 75, 20) $nBegin = TimerInit() For $i = 0 To $iLines - 1 $iIndex = _ArraySearch($bFile, $aInFile[$i][1], 0, 0, 0, 0, 1, 0) ; search only col. 0 ; $iIndex = _ArrayBinarySearch($bFile, $aInFile[$i][1], 0, 0, 0) ; use only if "Users.txt" is sorted $user = (($iIndex <> -1) ? ($bFile[$iIndex][1]) : ("Unknown ID")) GUICtrlCreateListViewItem($aInFile[$i][0] & "|" & $aInFile[$i][1] & "|" & _ $aInFile[$i][2] & "|" & $aInFile[$i][3] & "|" & $aInFile[$i][4] & "|" & $user, $lv) Next ConsoleWrite(TimerDiff($nBegin) & @CRLF) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited October 19, 2019 by pixelsearch mucitbey 1 Link to comment Share on other sites More sharing options...
Zedna Posted October 18, 2019 Share Posted October 18, 2019 (edited) I think that my solution (without _ArraySearch) will be faster, especially at high number of items in both files/arrays. Edited October 18, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
pixelsearch Posted October 19, 2019 Share Posted October 19, 2019 (edited) @Zedna : you're right, especially if Users.txt file is unsorted and _ArrayBinarySearch() can't be used. When Users.txt file is sorted by ID's and _ArrayBinarySearch() can be used, then I find a difference of 100ms (1/10s) on my antique computer, based on a Users.txt file containing 500 rows (500 different users, sorted ID's) and a "20191015.txt" file containing 1000 rows (500 employees check-in + 500 check-out the same day, users ID's totally unsorted in "20191015.txt" based on a double shuffle) In case someone likes to test it, here are the 2 scripts I wrote to generate both text files, 1st script will create "Users.txt" (500 rows, ID's sorted) #include <Array.au3> #include <File.au3> Local $aUser[500] ; 500 employees ID from 00000001 To 00000500 For $i = 0 To 499 $aUser[$i] = StringFormat("%08s", $i) & "=" & "Employee #" & $i Next _ArrayDisplay($aUser, "$aUser") ; _ArrayShuffle($aUser) ; If shuffled, then don't use _ArrayBinarySearch() in scripts above +++ ; _ArrayDisplay($aUser, "$aUser - Shuffled") $sFilePath = @ScriptDir & "\Users.txt" _FileWriteFromArray($sFilePath, $aUser) ShellExecute($sFilePath) 2nd script will create "20191015.txt" (1000 rows : 500 check-in + 500 check-out) expandcollapse popup#include <Array.au3> #include <Date.au3> #include <File.au3> Global $sDate_New Local $aUser ; 500 rows (500 users) Local $aCheckFile[2*500] ; 1000 rows (500 check-in, 500 check-out) _FileReadToArray(@ScriptDir & "\Users.txt", $aUser, $FRTA_NOCOUNT, "=") _ArrayDisplay($aUser, "$aUser") _ArrayShuffle($aUser) ; _ArrayDisplay($aUser, "$aUser shuffled #1") Local $sDate_Start = "2019/10/01 06:59:45" ; start check-in time For $i = 0 To 499 $sDate_Write = Date_Calc($sDate_Start) $aCheckFile[$i] = "001," & $aUser[$i][0] & ",0," & $sDate_Write $sDate_Start = $sDate_New Next _ArrayDisplay($aCheckFile, "$aCheckFile - check-in") _ArrayShuffle($aUser) ; _ArrayDisplay($aUser, "$aUser shuffled #2") $sDate_Start = "2019/10/01 15:59:45" ; start check-out time For $i = 500 To 999 $sDate_Write = Date_Calc($sDate_Start) $aCheckFile[$i] = "001," & $aUser[$i - 500][0] & ",0," & $sDate_Write $sDate_Start = $sDate_New Next _ArrayDisplay($aCheckFile, "$aCheckFile - full day") $sFilePath = @ScriptDir & "\20191015.txt" _FileWriteFromArray($sFilePath, $aCheckFile) ShellExecute($sFilePath) ;==================================================== Func Date_Calc($sDate) $sDate_New = _DateAdd("s", 15 , $sDate) ; add 15s between each user check ; MsgBox($MB_TOPMOST, $sDate, $sDate_New) ; ex. "2019/10/01 07:00:00" Local $sDate_Ret = _ Int(StringMid($sDate_New, 9, 2)) & "." & _ ; day Int(StringMid($sDate_New, 6, 2)) & "." & _ ; month StringLeft($sDate_New, 4) & _ ; year StringRight($sDate_New, 9) ; time ; MsgBox($MB_TOPMOST, $sDate_New, $sDate_Ret) ; ex. "1.10.2019 07:00:00" Return $sDate_Ret EndFunc I added 2 parts in the scripts of the precedent messages : * A timer to know exactly how much time the loop takes (I did it on Zedna's script too, saved on my computer) : $nBegin = TimerInit() For $i = 0 To $iLines - 1 ... Next ConsoleWrite(TimerDiff($nBegin) & @CRLF) * A line _ArrayBinarySearch() has been added too, but it will work only if Users.txt is sorted. Only then, times will be similar to Zedna's (based on 500 users & 1000 checks) though he still beats _ArrayBinarySearch() by... 100 ms $iIndex = _ArraySearch(...) ; $iIndex = _ArrayBinarySearch(...) ; use only if "Users.txt" is sorted on ID's +++ Edit : I just did an interesting test, multiplying everything by 10 ! Which means 5.000 users in "Users.txt" and 10.000 checks (rows) in the 2nd text file "20191015.txt" Now _ArrayBinarySearch() beats everybody, with times of reply < 5s (Zedna is about 9s) Let's forget _ArraySearch() in this case because the reply times are much too long. Personally, I always liked _ArrayBinarySearch() and use it as much as I can with great results. So mucitbey, now it's up to you and you have a choice to make, depending on : * the number of rows in both text files. * the fact that "Users.txt" is sorted or not : if it's sorted and you are 100% sure that it will always be sorted (because of the way it is generated), then you can use _ArrayBinarySearch() with fastest results in case your text files are very big. But if it may happen that "Users.txt" isn't always sorted, then don't hesitate and choose Zedna's way. Good luck Edited October 19, 2019 by pixelsearch Test on 5.000 users and 10.000 checks ! mucitbey 1 Link to comment Share on other sites More sharing options...
mucitbey Posted October 19, 2019 Author Share Posted October 19, 2019 (edited) Hi @pixelsearch;I'm guessing that the "User.txt" file will have a maximum of 150-200 rows sequentially, and the "20191015.txt" file will have a maximum of 500 sequential rows per day. If I process this data weekly, there will be approximately 3,500 lines.2. Do you have any suggestions about the item? I'm sorry for the language translation. I mean; if the time value is between 08:10:00 and 16.50: 00, is it possible that these values will appear in a different color?Or you have prepared the code and sorted by hour to send the Excel file. Thank you for your help. Edited October 19, 2019 by mucitbey Link to comment Share on other sites More sharing options...
pixelsearch Posted October 19, 2019 Share Posted October 19, 2019 (edited) Hi mucitbey, 1 line of code could do that, but it will color the whole line (which shouldn't be a big problem ?) Coloring only the time column seems a bit harder, though doable (I've been told) Depending on the script you will choose, add one of these lines, just after the GUICtrlCreateListViewItem() line : If $aInFile[$i][4] > "08:10:00" And $aInFile[$i][4] < "16:50:00" Then _ GUICtrlSetBkColor(-1, 0xDDFFE0) ; light green ; or If $aTemp[4] > "08:10:00" And $aTemp[4] < "16:50:00" Then _ GUICtrlSetBkColor(-1, 0xC0FFFF) ; light blue is great too ! Good luck Edited October 19, 2019 by pixelsearch mucitbey 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now