Jump to content

Recommended Posts

Posted

Hello!

How create a text file and write log into the created text file?

1. Check if the log.txt file is existing or not?

2. If exit, then write the defined content into the log.txt in replacement methd

e.g. Content in log.txt is OK

Just update OK or Problems

Posted

"1. Check if the log.txt file is existing or not?"

If FileExists($sLogPath) = 0 Then FileCreate($folder_path & "\Log.txt")

or

If FileExists($sLogPath) = 0 Then MsgBox(0, "Error", "Log file does not exist.")

or whatever.

  • 1 month later...
Posted

..NOOB ALERT..

Trying to write the results of an array to a log file but it's writing nothing. Apparently I'm missing something..

$FileList=_FileListToArray("C:\Lanvera")
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_FileWriteLog("C:\Lanvera\Log" & "\my.log",$FileList)
_ArrayDisplay($FileList,"$FileList")

should I put a loop into the script??

much appreciated...

Posted (edited)

$FileList=_FileListToArray("C:\Lanvera")
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
For $X = 1 to $FileList[0]
_FileWriteLog("C:\Lanvera\Log" & "\my.log",$FileList[$X])
Next
_ArrayDisplay($FileList,"$FileList")

Edited by weaponx

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...