Chetwood Posted February 22, 2008 Posted February 22, 2008 Silly me, I thought a one-dimensional array would be piece of cake but apparently I just don't get it! I want to write the folders one has selected from input boxes into a text file, so here is my array: $num_discs = InputBox("", "How many folders?", "", "") Global $discs[$num_discs] For $i = 0 to $num_discs - 1 $discs[$i] = FileSelectFolder("Select folder", "", 4, "") Next _ArrayDisplay displays the array as expected but I cannot write it to "folders.txt" which would look like this: folder1 folder2 folder3 TIA! MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Zedna Posted February 22, 2008 Posted February 22, 2008 Func _FileWriteFromArray($File, $a_Array, $i_Base = 0, $i_UBound = 0) Resources UDF ResourcesEx UDF AutoIt Forum Search
Chetwood Posted February 22, 2008 Author Posted February 22, 2008 Thanks, are this functions mentioned somewhere in the help file? I've used "_FileWriteFromArray("array.txt",$discs)" for my example above, in that case the file is written but the first line is emtpy and folder1 starts in line 2. Also, I'm not too sure about the syntax when adding additional info to each line like folder 1 has disc1 folder 2 ; some comment folder 3\file.lst MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
MHz Posted February 22, 2008 Posted February 22, 2008 Yes, FileWriteFromArray() is a standard UDF included with the AutoIt installation and is listed in the help file. Would advise checking options within the help file on FileWriteFromArray() and if you still have your issues, then post what concerns you have.
Chetwood Posted February 22, 2008 Author Posted February 22, 2008 Well, now that I started the AutoIt3Help.exe instead of AutoIt3.chm a search for FileWriteFromArray() turned up results. However, I'm still not sure whether this function does what I want. In my example I have 3 folders written to an array (index 0 to 2) and I want each entry to be written to a seperate text file and add my own text to it, file1.txt looks like thisd:\folder1\video_ts.ifo d:\folder1 comes from array index1\video_ts.ifo is added by me MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
muhmuuh Posted February 22, 2008 Posted February 22, 2008 Something like this? $num_discs = InputBox("", "How many folders?", "", "") Global $discs[$num_discs], $f[10] For $i = 0 to $num_discs - 1 $f=FileOpen("folder" & $i+1 & ".txt", 2) $discs[$i] = FileSelectFolder("Select folder", "", 4, "") FileWriteLine($f, $discs[$i] & " your additional info") FileClose($f) Next I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.
Chetwood Posted February 23, 2008 Author Posted February 23, 2008 (edited) Thanks, it does what I want. But as you've guessed, I'm not getting the code. Global $f[10] seems to define another array but why one with 10 elements? I want to write as many files as there a discs so why not Global $f[$num_discs]? I also need to check whether each index item ends with a \ and if so the backslash has to be deleted. Edited February 23, 2008 by Chetwood MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
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