Jump to content

Edit a line of a text file


Recommended Posts

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.txt

It reads as follows;

application = Powersolve

wincommand  = sor32 Pow32x

windirecto  = C:\RadiusV5\Rcs\POW32GUI

login      =

password    =

ttype      = rad_view

command    =

commreqd    = no

remlogin    =

rempassword =

remservice  =

remsession  = 4

remmethod  =

remname    =

background  =

remconnect  = no

addreply1  = rad_view

addreply2  = 1

ddesync    = 1000

and I want to change the addreply2 = 1 to be addreply2 = ps_live

Please help :lmao:

Link to comment
Share on other sites

$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

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 by ErinC
Link to comment
Share on other sites

You're welcome :lmao:.

[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

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...