Sign in to follow this  
Followers 0
ITSky8

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

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#include <File.au3>

_FileWriteLog ( $sLogPath, $sLogMsg )

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

right on worked perfect.. thanks a lot Weaponx sniper...

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