pintas Posted April 9, 2019 Share Posted April 9, 2019 Hi guys, I have several (ini) files and i'm trying to place their respective [Check] section into a listview as such: Name Mail Popup Google 0 x Amazon x x Example ini Google file section: [Check] CheckMail=0 Popup=1 Example Amazon file Section: [Check] CheckMail=1 Popup=1 I'm lost with the dimensional arrays. I'm getting a vertical output instead of an horizontal one. Can someone please help me out? Link to comment Share on other sites More sharing options...
Nine Posted April 9, 2019 Share Posted April 9, 2019 Can you provide the code you have written so far ? “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...
pintas Posted April 9, 2019 Author Share Posted April 9, 2019 (edited) 42 minutes ago, Nine said: Can you provide the code you have written so far ? #include <GUIConstantsEx.au3> #include <DateTimeConstants.au3> #include <Process.au3> #include <GUIConstants.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #Include <Date.au3> #include <constants.au3> AutoItSetOption ("ExpandVarStrings" , 1) Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 400, 500,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 32, 300, 197) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) GUISetState() $var = IniReadSection(@ScriptDir&"\Sites\Google", "Check") ;_ArrayDisplay ($var) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) For $i = 1 To $var[0][0] _GUICtrlListView_AddItem($listview, $var[$i][0], 0) _GUICtrlListView_AddSubItem($listview, $i - 1, $var[$i][1], 1, $i) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Sorry... I'm still trying to figure out how to place the items in horizontal position and later i need to do a for loop to search for the files and include them in the listview. Edited April 9, 2019 by pintas Link to comment Share on other sites More sharing options...
Nine Posted April 9, 2019 Share Posted April 9, 2019 _GUICtrlListView_AddItem($listview, "Google", 0) For $i = 1 To $var[0][0] _GUICtrlListView_AddSubItem($listview, 0, $var[$i][1], $i) Next Try this. I hardcoded Google to get you an idea how to do it.... pintas 1 “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...
pintas Posted April 9, 2019 Author Share Posted April 9, 2019 12 minutes ago, Nine said: _GUICtrlListView_AddItem($listview, "Google", 0) For $i = 1 To $var[0][0] _GUICtrlListView_AddSubItem($listview, 0, $var[$i][1], $i) Next Try this. I hardcoded Google to get you an idea how to do it.... Nice! Now i understood the key value placement is the '1'. Veru nice indeed. Thank you @Nine! Link to comment Share on other sites More sharing options...
Subz Posted April 9, 2019 Share Posted April 9, 2019 You could also just use _GUICtrlListView_AddArray for example: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $g_aSiteFileData[0][3] _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, $g_aSiteFileData) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSiteData() Local $aSiteFileData Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Error", "An error occurred while getting site ini files.") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($g_aSiteFileData, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next EndFunc pintas 1 Link to comment Share on other sites More sharing options...
pintas Posted April 9, 2019 Author Share Posted April 9, 2019 1 hour ago, Subz said: You could also just use _GUICtrlListView_AddArray for example: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $g_aSiteFileData[0][3] _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, $g_aSiteFileData) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSiteData() Local $aSiteFileData Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Error", "An error occurred while getting site ini files.") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($g_aSiteFileData, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next EndFunc Cool. I have to say it seems a bit more complex, but i'll study to understand it. I wish i had more time to learn... Thanks @Subz! Link to comment Share on other sites More sharing options...
pintas Posted April 11, 2019 Author Share Posted April 11, 2019 (edited) On 4/9/2019 at 10:59 AM, Subz said: You could also just use _GUICtrlListView_AddArray for example: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $g_aSiteFileData[0][3] _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, $g_aSiteFileData) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSiteData() Local $aSiteFileData Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Error", "An error occurred while getting site ini files.") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($g_aSiteFileData, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next EndFunc While this option basically solves most of my problems, i can't redraw the items once i first update listview. So if i delete a file, for example, and try to update the listview, first with destroy or deleteallitems and then call the function again, it doesn't work. How can i update the values? Edited April 11, 2019 by pintas Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 11, 2019 Share Posted April 11, 2019 @pintas If you put a _GUICtrlListView_DeleteAllItems() before populating the listview, that should do the trick Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
pintas Posted April 11, 2019 Author Share Posted April 11, 2019 9 minutes ago, FrancescoDiMuro said: @pintas If you put a _GUICtrlListView_DeleteAllItems() before populating the listview, that should do the trick Thanks for the prompt reply. It doesn't do anything. I can't even destroy the control and create it again. I've tried everything... doesn't work. Link to comment Share on other sites More sharing options...
Belini Posted April 11, 2019 Share Posted April 11, 2019 Did you put the Listview Control ID? _GUICtrlListView_DeleteAllItems($listview) My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
BrewManNH Posted April 11, 2019 Share Posted April 11, 2019 Do you delete the entry in the array as well? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Nine Posted April 11, 2019 Share Posted April 11, 2019 Global vars can be tricky. You should always try not to use it, unless it is absolutely necessary... expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Local $aSiteFile = _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, $aSiteFile) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSiteData() Local $aSiteFileData, $aResult [0][3] Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Error", "An error occurred while getting site ini files.") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($aResult, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next Return $aResult EndFunc pintas 1 “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...
pintas Posted April 11, 2019 Author Share Posted April 11, 2019 1 hour ago, Belini said: Did you put the Listview Control ID? _GUICtrlListView_DeleteAllItems($listview) I did. Nothing happens. 1 hour ago, BrewManNH said: Do you delete the entry in the array as well? I tried but it doesn't delete anything. 24 minutes ago, Nine said: Global vars can be tricky. You should always try not to use it, unless it is absolutely necessary... expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Local $aSiteFile = _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, $aSiteFile) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSiteData() Local $aSiteFileData, $aResult [0][3] Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Error", "An error occurred while getting site ini files.") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($aResult, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next Return $aResult EndFunc Thank you, but now the listview is empty. ☹️ Link to comment Share on other sites More sharing options...
Nine Posted April 11, 2019 Share Posted April 11, 2019 Works fine for me... “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...
Subz Posted April 11, 2019 Share Posted April 11, 2019 (edited) If you want to continuously monitor your @ScriptsDir@\Sites folder you can use something like the following: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $g_idListview, $g_aSiteFileData[0][3] _SiteDataView() Func _SiteDataView() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) Local $g_hGUIApp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $g_idListview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($g_idListview, $exStyles) _GUICtrlListView_AddColumn($g_idListview, "Name", 120) _GUICtrlListView_AddColumn($g_idListview, "Mail", 120) _GUICtrlListView_AddColumn($g_idListview, "Popup", 120) GUISetState() AdlibRegister("_GetSiteData") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func _GetSiteData() Local $aSiteFileData Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Fatal Error", "No ini files found in @ScriptDir@\Sites folder, exiting script.") ;~ This will actively check if files have been added or removed from the @ScriptDir@\Sites\ folder If $aSiteFilePath[0] = UBound($g_aSiteFileData) Then Return ReDim $g_aSiteFileData[0][3] Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($g_aSiteFileData, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next _GUICtrlListView_DeleteAllItems($g_idListview) _GUICtrlListView_AddArray($g_idListview, $g_aSiteFileData) EndFunc Edited April 11, 2019 by Subz pintas 1 Link to comment Share on other sites More sharing options...
pintas Posted April 11, 2019 Author Share Posted April 11, 2019 1 hour ago, Nine said: Works fine for me... I'm sorry. It's working. I forgot to add another item to the array, so it was returning a blank result. I can now clean the listview. But how can i update it? Sorry to trouble you, and thank you guys for your precious help. Link to comment Share on other sites More sharing options...
BrewManNH Posted April 11, 2019 Share Posted April 11, 2019 3 hours ago, pintas said: Global vars can be tricky. You should always try not to use it, unless it is absolutely necessary... Aren't all of these still Globals? Local $aSiteFile = _GetSiteData() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) And didn't you just create an unnecessary Global that could have been done this way? ;~ Local $aSiteFile = _GetSiteData() <<<<<<<< Unecessary Global variable created when you can just use the return directly ;~ Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) <<<<<<<<<<<< Unless you plan on changing the styles, for example for testing a lot, this Global is also unnecessary $guiapp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $listview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) _GUICtrlListView_AddColumn($listview, "Name", 120) _GUICtrlListView_AddColumn($listview, "Mail", 120) _GUICtrlListView_AddColumn($listview, "Popup", 120) _GUICtrlListView_AddArray($listview, _GetSiteData()) FrancescoDiMuro 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
pintas Posted April 11, 2019 Author Share Posted April 11, 2019 3 hours ago, Subz said: If you want to continuously monitor your @ScriptsDir@\Sites folder you can use something like the following: expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $g_idListview, $g_aSiteFileData[0][3] _SiteDataView() Func _SiteDataView() Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) Local $g_hGUIApp = GUICreate("test" , 390, 220,-1, -1, -1); WS_EX_ACCEPTFILES $g_idListview = GUICtrlCreateListView("", 10, 10, 370, 200) _GUICtrlListView_SetExtendedListViewStyle($g_idListview, $exStyles) _GUICtrlListView_AddColumn($g_idListview, "Name", 120) _GUICtrlListView_AddColumn($g_idListview, "Mail", 120) _GUICtrlListView_AddColumn($g_idListview, "Popup", 120) GUISetState() AdlibRegister("_GetSiteData") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func _GetSiteData() Local $aSiteFileData Local $aSiteFilePath = _FileListToArrayRec("@ScriptDir@\Sites", "*.ini", 1, 0, 1, 2) If @error Then Exit MsgBox(4096, "Fatal Error", "No ini files found in @ScriptDir@\Sites folder, exiting script.") ;~ This will actively check if files have been added or removed from the @ScriptDir@\Sites\ folder If $aSiteFilePath[0] = UBound($g_aSiteFileData) Then Return ReDim $g_aSiteFileData[0][3] Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" For $i = 1 To $aSiteFilePath[0] $aSiteFileData = IniReadSection($aSiteFilePath[$i], "Check") If @error Then ContinueLoop ;~ Error reading ini file $aFilePath = _PathSplit($aSiteFilePath[$i], $sDrive, $sDir, $sFileName, $sExtension) _ArrayAdd($g_aSiteFileData, "$sFileName$|" & _ArrayToString($aSiteFileData, "|", 1, -1, "|", 1, 1)) Next _GUICtrlListView_DeleteAllItems($g_idListview) _GUICtrlListView_AddArray($g_idListview, $g_aSiteFileData) EndFunc I just saw your answer... Thank you. It reeeeeally solved my problems. Thank you so much. I actually use a button to remove the item/correspondent file, but i just removed the loop and placed the 'DeleteAllItems' and 'AddArray' after the button action and it is perfect now. Link to comment Share on other sites More sharing options...
Nine Posted April 11, 2019 Share Posted April 11, 2019 (edited) 5 hours ago, BrewManNH said: Aren't all of these still Globals? Yes they are all. You seem to think you are the only one knowing that. But what you don't obviously understand, it is not the way you declare variables, but it is the way you use them. It get kind of annoying for you to repeat the same old evidence, like an old man would repeat the same old story. Stop that ! ps. I know you won't, because you cannot stand having the last word. So go for it, I will let you have the last one... Edited April 11, 2019 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...
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