Jump to content

"fileclose" not working


shay
 Share

Recommended Posts

Hi all

i`m using this scrip(part of larger script)

i have problems with "FileClose"

will script running the "FileClose" not working (files are locked by the script)

any idea? :)

;Append loges to master files
        $ORG_gui = "D:\GuiLog.txt"
        $msater_GUI = "D:\master_guilog.txt"
    
        $ORG_btlog = "D:\bitratelog.csv"
        $msater_btlog = "D:\master_btlog.csv"

        $ORG_clientlog = "D:\clientLog.txt"
        $msater_clientlog = "D:\master_ClientLog.txt"

        ;gui
        $file = FileOpen($ORG_gui, 0)
        $read1 = FileRead ($ORG_gui)
        sleep(700)
        FileOpen($msater_GUI, 9)
        FileWrite($msater_GUI,  @CR & @LF  &"**new file" & @CR & @LF)
        FileWrite ($msater_GUI, $read1)
        sleep(1700)
        FileClose($ORG_gui)
        FileClose($msater_GUI)

        ;bitratelog
        $file = FileOpen($ORG_btlog, 0)
        $read2 = FileRead ($ORG_btlog)
        sleep(700)
        FileOpen($msater_btlog, 9)
        FileWrite($msater_btlog, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($msater_btlog, $read2)
        sleep(1700)
        FileClose($ORG_btlog)
        FileClose($msater_btlog)

        ;clientLog
        $file = FileOpen($ORG_clientlog, 0)
        $read3 = FileRead ($ORG_clientlog)
        sleep(700)
        FileOpen($msater_clientlog, 9)
        FileWrite($msater_clientlog, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($msater_clientlog, $read3)
        sleep(1700)
        FileClose($ORG_clientlog)
        FileClose($msater_clientlog)

"If the facts don't fit the theory, change the facts." Albert Einstein

Link to comment
Share on other sites

Hi all

i`m using this scrip(part of larger script)

i have problems with "FileClose"

will script running the "FileClose" not working (files are locked by the script)

any idea? :)

;Append loges to master files
        $ORG_gui = "D:\GuiLog.txt"
        $msater_GUI = "D:\master_guilog.txt"
    
        $ORG_btlog = "D:\bitratelog.csv"
        $msater_btlog = "D:\master_btlog.csv"

        $ORG_clientlog = "D:\clientLog.txt"
        $msater_clientlog = "D:\master_ClientLog.txt"

        ;gui
        $file = FileOpen($ORG_gui, 0)
        $read1 = FileRead ($ORG_gui)
        sleep(700)
        FileOpen($msater_GUI, 9)
        FileWrite($msater_GUI,  @CR & @LF  &"**new file" & @CR & @LF)
        FileWrite ($msater_GUI, $read1)
        sleep(1700)
        FileClose($ORG_gui)
        FileClose($msater_GUI)

        ;bitratelog
        $file = FileOpen($ORG_btlog, 0)
        $read2 = FileRead ($ORG_btlog)
        sleep(700)
        FileOpen($msater_btlog, 9)
        FileWrite($msater_btlog, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($msater_btlog, $read2)
        sleep(1700)
        FileClose($ORG_btlog)
        FileClose($msater_btlog)

        ;clientLog
        $file = FileOpen($ORG_clientlog, 0)
        $read3 = FileRead ($ORG_clientlog)
        sleep(700)
        FileOpen($msater_clientlog, 9)
        FileWrite($msater_clientlog, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($msater_clientlog, $read3)
        sleep(1700)
        FileClose($ORG_clientlog)
        FileClose($msater_clientlog)

Hi,

FileClose uses FileHandles. So use FileHandles consequent through your script and don't mix FileHandles and path.

;Append loges to master files
        $ORG_gui = "D:\GuiLog.txt"
        $msater_GUI = "D:\master_guilog.txt"
    
        $ORG_btlog = "D:\bitratelog.csv"
        $msater_btlog = "D:\master_btlog.csv"

        $ORG_clientlog = "D:\clientLog.txt"
        $msater_clientlog = "D:\master_ClientLog.txt"

        ;gui
        $file = FileOpen($ORG_gui, 0)
        $read1 = FileRead ($file)
        sleep(700)
        $file1 = FileOpen($msater_GUI, 9)
        FileWrite($file1,  @CR & @LF  &"**new file" & @CR & @LF)
        FileWrite ($file1, $read1)
        sleep(1700)
        FileClose($file)
        FileClose($file1)

        ;bitratelog
        $file = FileOpen($ORG_btlog, 0)
        $read2 = FileRead ($file)
        sleep(700)
        $file1 = FileOpen($msater_btlog, 9)
        FileWrite($file1, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($file1, $read2)
        sleep(1700)
        FileClose($file)
        FileClose($file1)

        ;clientLog
        $file = FileOpen($ORG_clientlog, 0)
        $read3 = FileRead ($file)
        sleep(700)
        $file1 = FileOpen($msater_clientlog, 9)
        FileWrite($file1, @CR & @LF & "**new file"& @CR & @LF)
        FileWrite ($file1, $read3)
        sleep(1700)
        FileClose($file)
        FileClose($file1)

;-))

Stefan

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