ErinC Posted March 8, 2005 Share Posted March 8, 2005 Hi, I am trying to edit a line of a text file, but can't quite get it working properly.I need to edit a file called C:\Radiusv5\Rcs\Pow32gui\hostconn.txtIt reads as follows;application = Powersolvewincommand = sor32 Pow32xwindirecto = C:\RadiusV5\Rcs\POW32GUIlogin = password = ttype = rad_viewcommand = commreqd = noremlogin = rempassword = remservice = remsession = 4remmethod = remname = background = remconnect = noaddreply1 = rad_viewaddreply2 = 1ddesync = 1000and I want to change the addreply2 = 1 to be addreply2 = ps_livePlease help Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 8, 2005 Share Posted March 8, 2005 $file = FileOpen ( "C:\Radiusv5\Rcs\Pow32gui\hostconn.txt", 0 ) Dim $Contents While 1 $Line = FileReadLine ( $file ) If @error Then Exitloop If $Line = "addreply = 1" Then $Line = "addreply2 = ps_live" $Contents = $Contents & @CRLF & $Line WEnd FileClose ( $file ) $file = FileOpen ( "C:\Radiusv5\Rcs\Pow32gui\hostconn.txt", 2 ) FileWrite ( $file, $Contents ) not sure but i think that will do it [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
ErinC Posted March 8, 2005 Author Share Posted March 8, 2005 (edited) Hey, thanks for taking the time to look at this .. That code you posted seems to work ok but it leaves a blank line at the beginning of the file .. any way of getting rid of that ? Edited March 8, 2005 by ErinC Link to comment Share on other sites More sharing options...
ErinC Posted March 8, 2005 Author Share Posted March 8, 2005 aha ! I switched the @CRLF and $Line in the $contents= line and all is well Thanks again Xenogis ! Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 8, 2005 Share Posted March 8, 2005 You're welcome . [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] 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