Jump to content

Read & Write


Recommended Posts

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

  • Developers

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 ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

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