ea9000 0 Posted August 5, 2010 Hi all, want to ask if there is way to using "FOR ,NEXT" function or any other loop to read an ini file? my idea to read a certain segment of an ini file and go through the lines to create the directories , later if I add a new line in the ini and run the script (a compiled ) it will fetch the line and create the directory of that line. thnx in advance Emad Share this post Link to post Share on other sites
notsure 0 Posted August 5, 2010 #Include <File.au3> local $countlines = _FileCountLines("myNiceIni.ini") local $file = FileOpen("myNiceIni.ini", 0) For $x = 1 to $countlines $directory = FileReadLine($file) ;your code here. next Like this? Share this post Link to post Share on other sites
ea9000 0 Posted August 5, 2010 more or less like this ,this read all lines in file ,I need to put a validation that reads a specific ini segment and fetch the lines from it. thanx for the fast replay Share this post Link to post Share on other sites
smashly 12 Posted August 5, 2010 Hi,Global $Ini = @ScriptDir & "\Dir.ini" Global $aIRS = IniReadSection($Ini, "DIRECTORY") If Not @error Then For $i = 1 To $aIRS[0][0] If Not FileExists(@ScriptDir & "\" & $aIRS[$i][1]) Then DirCreate(@ScriptDir & "\" & $aIRS[$i][1]) Next EndIfI used in my Dir.ini[DIRECTORY] Dir=Test1\Sub1 Dir=Test2\Sub1\Sub2 Dir=Test3\Sub1\Sub2\Sub3 Dir=Test4\Sub1\Sub2\Sub3\Sub4 Cheers Share this post Link to post Share on other sites
ea9000 0 Posted August 5, 2010 great job this what i want cheers Share this post Link to post Share on other sites