FireLord Posted November 19, 2007 Share Posted November 19, 2007 How do I import words from a text file to an INI. Text file format would be: word1 word2 word3 ... to an INI format like this: Key=word1,word2,word3, Regards, FireLord [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
Jex Posted November 19, 2007 Share Posted November 19, 2007 #include <File.au3> $Key = "" $Count = _FileCountLines("Test.txt") For $i = 1 To $Count $Text = FileReadLine("Test.txt", $i) If $i = 1 Then $Key = $Text & "," ElseIf $i = $Count Then $Key = $Key & $Text Else $Key = $Key & $Text & "," EndIf Next FileWrite("Test.ini", "Key=" & $Key) My scripts : Immediate Window , My Web Browser , Travian , Text Effect , Characters & Words per minute or second , Image Editor (ImageMagick) , Matrix style background effect ( Screensaver ) , Mail Sender , Protectlinks decoder and Rapidshare links checker , Fonts Fetcher , Region determine , Compare pictures , Gradient color box , Mouse Coordinates, Colors, Pixel Search things , Encrypt/Decrypt and embeding file in jpeg thing , Hard disk space monitor , Reflex game , Multiplayer Tic Tac Toe , WLM ( MSN ) personal message changer Link to comment Share on other sites More sharing options...
FireLord Posted November 19, 2007 Author Share Posted November 19, 2007 #include <File.au3> $Key = "" $Count = _FileCountLines("Test.txt") For $i = 1 To $Count $Text = FileReadLine("Test.txt", $i) If $i = 1 Then $Key = $Text & "," ElseIf $i = $Count Then $Key = $Key & $Text Else $Key = $Key & $Text & "," EndIf Next FileWrite("Test.ini", "Key=" & $Key) Thank you so much. This works great! [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
rasim Posted November 19, 2007 Share Posted November 19, 2007 One of the variant: #include <File.au3> Dim $TxtArray, $string _FileReadToArray(@ScriptDir & "\test.txt", $TxtArray) For $i = 1 To $TxtArray[0] $string &= $TxtArray[$i] & ", " Next $string = StringTrimRight($string, 2) IniWrite(@ScriptDir & "\test.ini", "Section", "Key", $string) Link to comment Share on other sites More sharing options...
FireLord Posted November 19, 2007 Author Share Posted November 19, 2007 One of the variant: #include <File.au3> Dim $TxtArray, $string _FileReadToArray(@ScriptDir & "\test.txt", $TxtArray) For $i = 1 To $TxtArray[0] $string &= $TxtArray[$i] & ", " Next $string = StringTrimRight($string, 2) IniWrite(@ScriptDir & "\test.ini", "Section", "Key", $string) Thanks. [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] 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