Search the Community
Showing results for tags 'saving array to script'.
-
Hello, I've been working on a program where a GUI with an input box and run button. User can enter in a 7 digit code and it will open up a file directory. The user can open up another GUI which enables them to save there own codes with an associated directory. This is done with a 2D array, where there is a column for the code, and a column for the file directory, there is also a column where user could enter in the path to a .exe file if they wanted to open a file instead of just the folder directory. Example of how the array could look: ;Savedcodes array columns[Codes][Address][EXE] #include <Array.au3> initiallist() Func initiallist();Initialization of array Global $savedcodes[1][2] ; Array for saving user entered commands $code = 0 $address = 1 ;Default codes $savedcodes[UBound($savedcodes)-1][$code] = "ggggggg";###Initialization### $savedcodes[UBound($savedcodes)-1][$address] = "G:\" _ArrayAdd($savedcodes, "") $savedcodes[UBound($savedcodes)-1][$code] = "ddddddd";###Initialization### $savedcodes[UBound($savedcodes)-1][$address] = "D:\" _ArrayAdd($savedcodes, "") $savedcodes[UBound($savedcodes)-1][$code] = "ccccccc";###Initialization### $savedcodes[UBound($savedcodes)-1][$address] = "C:\" _ArrayAdd($savedcodes, "") $savedcodes[UBound($savedcodes)-1][$code] = "hhhhhhh";###Initialization### $savedcodes[UBound($savedcodes)-1][$address] = "H:\" _ArrayDisplay($savedcodes) EndFunc Anyways everything runs pretty smoothly, however I am not sure how to save this array so that if the user was to close the program that they could use the codes they had entered in previously, without having to re-enter them in each time they open it. Any ideas on how best to achieve this? Users will not have administrative rights. The only way I can think of how to achieve this goal is by writing to the file, which I'd be totally happy doing. However I wouldn't know how to delete old lines that exist. I have a function already, that is able to read through a file and look for specific markers (say: ###Initialization###) and return that line number. If the marker was detected I could delete that line, and then add new lines for every element of array using the _FileWriteToLine(). Any idea if there is a function instead of writing to a specific line it would delete it?