Sign in to follow this  
Followers 0
rootx

FileWrite does not write anything

4 posts in this topic

I would like to edit a css file, and replace a string in the third line of it.
 
the msgbox working properly!! but he does not write anything... Why?
 
 
#include <File.au3>
#include <MsgBoxConstants.au3>
 
 
$file = FileOpen("C:UsersrootxDesktopphoto albumcssstyles2.css")
$read = FileReadLine($file,3)
$replace = StringRegExpReplace($read,"background","xxxxxxxxxxxxxxx")
MsgBox("","",$replace)
FileWriteLine($file,$replace)
FileClose($file)
 
thanks to all

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

You are using FileOpen as read only (by default). Check out the help file which mode you want to use.
 
Or use _FileWriteToLine

#include <File.au3>
#include <MsgBoxConstants.au3>

$read = FileReadLine("Test.txt",3)
$replace = StringRegExpReplace($read,"background","xxxxxxxxxxxxxxx")
MsgBox("","",$replace)
_FileWriteToLine ("Test.txt", 3, $replace , 1)

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

thanks UEZ

Share this post


Link to post
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
Sign in to follow this  
Followers 0