t0ddie Posted October 8, 2004 Share Posted October 8, 2004 (edited) i just want to go through a list, and replace the spaces with a colon. $file = FileOpen("ACCOUNTS.txt", 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop StringReplace($line," ",":") Wend FileClose($file) exit its not doing anything..... heh i have messed with it for about 45 minutes, and im stuck a little help? thanks Edited October 8, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 Is the file opening? Also you may want a Do...Until. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
t0ddie Posted October 8, 2004 Author Share Posted October 8, 2004 (edited) its not even changing the FIRST line.. yeah. its opening. other than that, i thought it was supposed to run till the end of the file.. hence the @error = -1 i got this from the help file ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) i just changed it a bit to do what i wanted. but yeah.. like i said, i have been at this about 45 min. i tried a few things. any sugggestions? EDIT: this shouldnt need a do.. until Edited October 8, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
emmanuel Posted October 8, 2004 Share Posted October 8, 2004 you're opening the file readonly, is that a problem? There's no point where you're writing the info back to the file, or to another one. i just want to go through a list, and replace the spaces with a colon.$file = FileOpen("ACCOUNTS.txt", 0)While 1 $line = FileReadLine($file)If @error = -1 Then ExitLoopStringReplace($line," ",":")WendFileClose($file)exitits not doing anything..... hehi have messed with it for about 45 minutes, and im stucka little help? thanks<{POST_SNAPBACK}> "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 I'm working on it.. so far I copied your code and created a file and I cant even get it to open :-/ JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
t0ddie Posted October 8, 2004 Author Share Posted October 8, 2004 well, i just run the script from the helpfile $file = FileOpen("ACCOUNTS.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) and when i run that, it works. i mean.. i get a message box, with the first line in the .txt file. it then gives me the second line.. third line... so on so on. can the stringreplace function see the space i put in the quotes? everything seems to be working fine except for the stringreplace line. but when i run this script.. it just ends. it does nothitng that i can see. $file = FileOpen("ACCOUNTS.txt",0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop StringReplace($line," ",":") Wend FileClose($file) exit so.. yeah. im stuck lol Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
emmanuel Posted October 8, 2004 Share Posted October 8, 2004 (edited) I'm working on it.. so far I copied your code and created a file and I cant even get it to open :-/JS<{POST_SNAPBACK}>My code? That's your code... I didn't change it at all.Edit: Excuse me, my mistake. Edited October 8, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted October 8, 2004 Share Posted October 8, 2004 You have to assing the return value of StringReplace() to something, it doesn't perform an in-line operation. Link to comment Share on other sites More sharing options...
t0ddie Posted October 8, 2004 Author Share Posted October 8, 2004 so, i would have to write them into a new file you are saying? or something like that? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 Okay I figured it out. (Kinda) You arent writing what you got back to the file...or to another file. $g_szVersion = "Test 1.0" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) $file = FileOpen("ACCOUNTS.txt", 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $linewrite = StringReplace($line," ",":") FileWriteLine("ACCOUNTS.txt", $linewrite) Wend FileClose($file) exit Play with that for a bit let me know how it works out for you. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 LOL you guys beat me to it, but there are some bugs... I just added the filewriteline() and it kept adding lines :-P Lots of them so maybe try writing it to a new file... $g_szVersion = "Test 1.0" If WinExists($g_szVersion) Then Exit; It's already running AutoItWinSetTitle($g_szVersion) $file = FileOpen("ACCOUNTS.txt", 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $linewrite = StringReplace($line," ",":") FileWriteLine("ACCOUNTS1.txt", $linewrite) Wend FileClose($file) exit It works... JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
t0ddie Posted October 8, 2004 Author Share Posted October 8, 2004 (edited) yeah, i ran that first one, and it copied my list to itself, in the new edited version.. with the colon.. over and over. the file was HUGE lol SECOND version works great TY! Edited October 8, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 YW I got same on the first :-P second just makes a new file for you JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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