Lgschez Posted March 6, 2020 Share Posted March 6, 2020 (edited) solved Edited March 10, 2020 by Lgschez Link to comment Share on other sites More sharing options...
Nine Posted March 6, 2020 Share Posted March 6, 2020 How about you create a zip file containing the root folder with its text files, and subfolders. Add also the script to the zip file. Make sure the script is runable with your folder, subfolders and text files. Upload the zip file in here. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Lgschez Posted March 7, 2020 Author Share Posted March 7, 2020 (edited) solvwed Edited March 10, 2020 by Lgschez Link to comment Share on other sites More sharing options...
argumentum Posted March 7, 2020 Share Posted March 7, 2020 @Lgschez, we all help based in our experience / expertise, and time availability. Sending me a PM will not do you any good. Just be patient. I'm sure @Nine will follow this thread when he logs in again. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Lgschez Posted March 7, 2020 Author Share Posted March 7, 2020 2 minutes ago, argumentum said: @Lgschez, we all help based in our experience / expertise, and time availability. Sending me a PM will not do you any good. Just be patient. I'm sure @Nine will follow this thread when he logs in again. Sorry, was trying to see if I could speed up the process. My apologies argumentum 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 7, 2020 Developers Share Posted March 7, 2020 4 hours ago, Lgschez said: Sorry, was trying to see if I could speed up the process. My apologies As stated in the PM you also send me and , as you stated, others: Stick the the forum rules and do not send pM's for soliciting support. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Nine Posted March 7, 2020 Share Posted March 7, 2020 Ok I tried to follow your script, but I do not understand what your are trying to achieve. Now that I a full example with appropriate txt files, could you explain what are the role of each text files and what is the end result. You gave me 2 examples, lets take one : D-Day. In folder "Example D-Day", you have a D-Day - 44.txt file, that contains a series of those : [Music] but in southern Russia Hitler's armies are being bled dry in a vicious fight against the Soviet Union In subfolder "Logs", you have also a file named D-Day - 44.txtlog.txt which contains somewhat the same information as the previous one but written in a different manner with those [Music] header at pretty much the same places. In that subfolder, you finally have a file named persons.txt, that contains a list of person names. For example : Winston Churchill | D-Day - 44.txt Margaret Compton | D-Day - 44.txt Churchill | D-Day - 44.txt All those names are accompanied with the same file name, the first one. Since your GUI is not very user friendly (no offense), I cannot understand the role of each file, and the result you want to display in that GUI. Could you explain what you want to achieve in using one of the name found in persons.txt, (e.g. Winston Churchill) and what you want to display to the user about that single person. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Lgschez Posted March 7, 2020 Author Share Posted March 7, 2020 6 hours ago, Nine said: Ok I tried to follow your script, but I do not understand what your are trying to achieve. Now that I a full example with appropriate txt files, could you explain what are the role of each text files and what is the end result. You gave me 2 examples, lets take one : D-Day. In folder "Example D-Day", you have a D-Day - 44.txt file, that contains a series of those : [Music] but in southern Russia Hitler's armies are being bled dry in a vicious fight against the Soviet Union In subfolder "Logs", you have also a file named D-Day - 44.txtlog.txt which contains somewhat the same information as the previous one but written in a different manner with those [Music] header at pretty much the same places. In that subfolder, you finally have a file named persons.txt, that contains a list of person names. For example : Winston Churchill | D-Day - 44.txt Margaret Compton | D-Day - 44.txt Churchill | D-Day - 44.txt All those names are accompanied with the same file name, the first one. Since your GUI is not very user friendly (no offense), I cannot understand the role of each file, and the result you want to display in that GUI. Could you explain what you want to achieve in using one of the name found in persons.txt, (e.g. Winston Churchill) and what you want to display to the user about that single person. Hi, thanks for getting back so soon. The folder that is selected in the Listbox is the folder that all other folders' persons.txt are going to be compared to. So for example, if you select folder Example Dday in the listbox and it finds a matching person in the persons.txt of that folder to any other folders in the root dictionary, it will list that relation under the corresponding tree element (in this case, Dday folder is selected so it will search all other folders for the same names as found in the Ddays persons.txt, and list that name under the folder it was found -- which out of the two folders the only ones with added elements in this case would be Stalingrad if matching names are found.. I hope I made it a little more clear, hard to explain. Ignore the buttons, to select the listbox element you just click on the listbox item and press ok on the msgbox. Thanks for your help and secondly I again apologize to those I sent pms so I could speed up the answering process, next time I will read the forum rules before I post. Link to comment Share on other sites More sharing options...
Nine Posted March 8, 2020 Share Posted March 8, 2020 (edited) I think I now understand what you are after. It was easier for me to rewrite your code. Now you will have to adapt it to fit your needs if you like it : expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> #include <File.au3> #include <Array.au3> #include <WinAPIGdi.au3> $Form1 = GUICreate("Form1", 405, 331, 192, 124) $Button1 = GUICtrlCreateButton("Start", 0, 0, 185, 49) $Button2 = GUICtrlCreateButton("Clear", 0, 50, 185, 49) GUICtrlSetState (-1, $GUI_DISABLE) $List1 = GUICtrlCreateList("", 184, 0, 217, 110) $TreeView1 = GUICtrlCreateTreeView(0, 128, 401, 105) $Edit1 = GUICtrlCreateEdit("Select a folder and press Start to search for cross-references" & @CRLF & _ "Press Clear to erase previous search", 0, 240, 401, 89) GUISetState(@SW_SHOW) Global $sFolder = FileRead("home.txt") If StringRight ($sFolder,1) <> "\" Then $sFolder &= "\" Global $FileList = _FileListToArray($sFolder, "*", $FLTA_FOLDERS) If @error = 1 Then Exit MsgBox(0, "", "Home Folder not Found.") If @error = 4 Then Exit MsgBox(0, "", "No SubFolder Found.") Global $aFile [UBound($FileList)-1], $iCount = 0 For $i = 1 To $FileList[0] If FileExists($sFolder & $FileList[$i] & "\logs\persons.txt") Then GUICtrlSetData($List1, $FileList[$i]) $aFile[$iCount] = $FileList[$i] $iCount += 1 EndIf Next ReDim $aFile[$iCount] Global $aPersons[UBound($aFile)], $aTreeItem[UBound($aFile)] InitRef () While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($List1) = "" Then MsgBox($MB_SYSTEMMODAL, "", "Please select a folder in the list") Else StartRef(GUICtrlRead($List1)) GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Button2, $GUI_ENABLE) EndIf Case $Button2 GUICtrlDelete ($TreeView1) $TreeView1 = GUICtrlCreateTreeView(0, 128, 401, 105) GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) EndSwitch WEnd Func InitRef() Local $aList For $i = 0 To UBound($aFile)-1 _FileReadToArray($sFolder & $aFile[$i] & "\logs\persons.txt",$aList,$FRTA_NOCOUNT,"|") _ArrayColDelete ($aList, 1, True) For $j = 0 to UBound($aList)-1 $aList[$j] = StringStripWS ($aList[$j],$STR_STRIPLEADING+$STR_STRIPTRAILING) Next $aPersons[$i] = $aList Next EndFunc Func StartRef ($sRef) Local $aRefList, $aList For $i = 0 To UBound($aFile)-1 If $sRef = $aFile[$i] Then $aRefList = $aPersons[$i] $aTreeItem[$i] = GUICtrlCreateTreeViewItem($aFile[$i], $TreeView1) Next For $i = 0 To UBound($aFile)-1 $aList = $aPersons[$i] For $j = 0 to UBound($aRefList)-1 _ArraySearch ($aList, $aRefList[$j]) If Not @error Then GUICtrlCreateTreeViewItem($aRefList[$j], $aTreeItem[$i]) Next Next _WinAPI_RedrawWindow ($Form1) EndFunc Edited March 9, 2020 by Nine corrected a small bug “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Lgschez Posted March 9, 2020 Author Share Posted March 9, 2020 10 hours ago, Nine said: I think I now understand what you are after. It was easier for me to rewrite your code. Now you will have to adapt it to fit your needs if you like it : expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> #include <File.au3> #include <Array.au3> #include <WinAPIGdi.au3> $Form1 = GUICreate("Form1", 405, 331, 192, 124) $Button1 = GUICtrlCreateButton("Start", 0, 0, 185, 49) $Button2 = GUICtrlCreateButton("Clear", 0, 50, 185, 49) GUICtrlSetState (-1, $GUI_DISABLE) $List1 = GUICtrlCreateList("", 184, 0, 217, 110) $TreeView1 = GUICtrlCreateTreeView(0, 128, 401, 105) $Edit1 = GUICtrlCreateEdit("Select a folder and press Start to search for cross-references" & @CRLF & _ "Press Clear to erase previous search", 0, 240, 401, 89) GUISetState(@SW_SHOW) Global $sFolder = FileRead("home.txt") Global $FileList = _FileListToArray($sFolder, "*", $FLTA_FOLDERS) If @error = 1 Then Exit MsgBox(0, "", "Home Folder not Found.") If @error = 4 Then Exit MsgBox(0, "", "No SubFolder Found.") Global $aFile [UBound($FileList)-1], $iCount = 0 For $i = 1 To $FileList[0] If FileExists($sFolder & $FileList[$i] & "\logs\persons.txt") Then GUICtrlSetData($List1, $FileList[$i]) $aFile[$iCount] = $FileList[$i] $iCount += 1 EndIf Next ReDim $aFile[$iCount] Global $aPersons[UBound($aFile)], $aTreeItem[UBound($aFile)] InitRef () While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($List1) = "" Then MsgBox($MB_SYSTEMMODAL, "", "Please select a folder in the list") Else StartRef(GUICtrlRead($List1)) GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Button2, $GUI_ENABLE) EndIf Case $Button2 GUICtrlDelete ($TreeView1) $TreeView1 = GUICtrlCreateTreeView(0, 128, 401, 105) GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) EndSwitch WEnd Func InitRef() Local $aList For $i = 0 To UBound($aFile)-1 _FileReadToArray($sFolder & $aFile[$i] & "\logs\persons.txt",$aList,$FRTA_NOCOUNT,"|") _ArrayColDelete ($aList, 1, True) For $j = 0 to UBound($aList)-1 $aList[$j] = StringStripWS ($aList[$j],$STR_STRIPLEADING+$STR_STRIPTRAILING) Next $aPersons[$i] = $aList Next EndFunc Func StartRef ($sRef) Local $aRefList, $aList For $i = 0 To UBound($aFile)-1 If $sRef = $aFile[$i] Then $aRefList = $aPersons[$i] $aTreeItem[$i] = GUICtrlCreateTreeViewItem($aFile[$i], $TreeView1) Next For $i = 0 To UBound($aFile)-1 $aList = $aPersons[$i] For $j = 0 to UBound($aRefList)-1 _ArraySearch ($aList, $aRefList[$j]) If Not @error Then GUICtrlCreateTreeViewItem($aRefList[$j], $aTreeItem[$i]) Next Next _WinAPI_RedrawWindow ($Form1) EndFunc Hey, I have been toying with your code and got it to work (had to fix a line or 2, was missing "\" from some addresses) but I am facing the same issue as my other code. Heres a screenshot : In Example D-Day Persons.txt I have as follows : Hitler In Example Stalingrad I have : Hitler Anchovies in the below picture you can see I selected Stalingrad, and the application listed Anchovies under D-Day even though Anchovies isn't in the persons.txt for D-Day. Thanks though, appreciate ya Link to comment Share on other sites More sharing options...
Nine Posted March 9, 2020 Share Posted March 9, 2020 (edited) I don't get the same result as you. My code is working fine, maybe your files are broken. Edited March 31, 2023 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nine Posted March 9, 2020 Share Posted March 9, 2020 (edited) Corrected the code to add a secure check on home folder to have a "\" at the end... And please do not quote everything I post, I know what I have told you, just do a simple reply. It makes the thread clumsy uselessly. Edited March 9, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Lgschez Posted March 9, 2020 Author Share Posted March 9, 2020 9 hours ago, Nine said: Corrected the code to add a secure check on home folder to have a "\" at the end... And please do not quote everything I post, I know what I have told you, just do a simple reply. It makes the thread clumsy uselessly. Ok thanks for your help, the script was clumsy uselessly but now it works. 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