Jump to content

Import from text file


FireLord
 Share

Recommended Posts

#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)

Link to comment
Share on other sites

#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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...