Sign in to follow this  
Followers 0
ForsakenGod

Read & Write

3 posts in this topic

Hello ,

This lil script i ve created should read an xml file (all its lines) and then rewrite it into an ini file but it only ready the first line any ideas ? ;)

HotKeySet("{F4}", "Write")


while 1
    Sleep(100)
Wend


Func Write()
    Global $file = FileOpenDialog("Oznac subor file", @ScriptDir & "\profily" , "(*.xml)")
    While 1
        $currentDirectory = @ScriptDir
        $line = 1
        FileOpen($file ,1)
        $linia = FileReadLine($file ,$line)
        $ulozenie = FileOpen($file ,1)
        FileWrite(@Scriptdir&"\profily\" & @WDAY & @HOUR & @MIN & ".ini" ,$linia & @CRLF)
        $line = $line + 1
    Wend
EndFunc

Share this post


Link to post
Share on other sites



Looks to me you set the $line to 1 every loop!

But really, when you want to read the whole file and write that to another file then open both file one time before the loop and then loop till the input file is totally read! Look at the example in the helpfile for FileReadLine().

Jos ;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Looks to me you set the $line to 1 every loop!

But really, when you want to read the whole file and write that to another file then open both file one time before the loop and then loop till the input file is totally read! Look at the example in the helpfile for FileReadLine().

Jos ;)

Dammit ur right x)) Thank you ill try it out

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