Cannonball Posted January 7, 2008 Posted January 7, 2008 Hi I have a function in AutoIt. In it i use _FileReadToArray but i always get a, that the File couldn`t read in the Array. I Use AutoIt 3.2.10.0 Sorry for my bad English and here the main Code i think you must see this to understand my problem $haip1 = GUICtrlRead($haip) Global $ipListen = $haip1 & '"' Global $file1 = "123.txt" Func _ersetzen() Dim $lines_A If Not _FileReadToArray($file1, $lines_A) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) ;this is the Error I always get. Exit EndIf For $i = 1 To $lines_A[0] If StringInStr($lines_A[$i], '<Listen Host = "') <> 0 Then $lines_A[$i] = ' <Listen Host = "' & $ipListen If StringInStr($lines_A[$i], ' ISHost =') <> 0 Then $lines_A[$i] = ' ISHost = ' & $ipListen Next _FileWriteFromArray($file1, $lines_A, 1) EndFunc I hope you can help me. Your Cannonball.
Simucal Posted January 7, 2008 Posted January 7, 2008 This works for me: #include <Array.au3> #include <File.au3> Global $file1 = "123.txt" _ersetzen() Func _ersetzen() Dim $lines_A If Not _FileReadToArray($file1, $lines_A) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) ;this is the Error I always get. Exit Else _ArrayDisplay($lines_A) EndIf EndFunc ;==>_ersetzen With a 123.txt file of: apples bananna pickle bin ladan In the same directory as the script. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Cannonball Posted January 7, 2008 Author Posted January 7, 2008 ok thanks Now i dont have the problem when ih changed it in: Func _ersetzen() Dim $lines_A If Not _FileReadToArray($file1, $lines_A) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf If StringInStr($lines_A[28], '<Listen Host = "') <> 0 Then $lines_A[28] = ' <Listen Host = "' & $ipListen If StringInStr($lines_A[29], ' ISHost =') <> 0 Then $lines_A[29] = ' ISHost = ' & $ipListen _FileWriteFromArray($file1, $lines_A, 1) EndFunc But now he don`t change the the text to $ipListen But were is the problem. When i take the Code I used in my first Post and thake for the $haip, that read what the user write in the Box, a Text like $haip = "123456789" that it works but not wen he reads the user input.... (I dont understand this )
Simucal Posted January 7, 2008 Posted January 7, 2008 ok thanks Now i dont have the problem when ih changed it in: Func _ersetzen() Dim $lines_A If Not _FileReadToArray($file1, $lines_A) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf If StringInStr($lines_A[28], '<Listen Host = "') <> 0 Then $lines_A[28] = ' <Listen Host = "' & $ipListen If StringInStr($lines_A[29], ' ISHost =') <> 0 Then $lines_A[29] = ' ISHost = ' & $ipListen _FileWriteFromArray($file1, $lines_A, 1) EndFunc But now he don`t change the the text to $ipListen But were is the problem. When i take the Code I used in my first Post and thake for the $haip, that read what the user write in the Box, a Text like $haip = "123456789" that it works but not wen he reads the user input.... (I dont understand this ) Not really sure what you are trying to do anymore. A full working script or example would be helpful. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Cannonball Posted January 7, 2008 Author Posted January 7, 2008 lol now it works but i don`t know what i have changed But thank you for your help^^
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