Jump to content

Send output to a log file


Recommended Posts

Help Needed:

i compared two files using TextFileCompare. The code is

$aFileCompare = TextFileCompare("E:\abc.txt", "E:\abc1.txt")

_ArrayDisplay($aFileCompare)

Func TextFileCompare($sFile1, $sFile2)

If Not FileExists($sFile1) Or Not FileExists($sFile2) Then Return

MsgBox(4096,"","not Matched!",3)

my prblem is:i am comapring if both file exists or not.If not then prompt a msg box.Instead of prompting msg i want to send the output to a log file

How to do it.

Link to post
Share on other sites

Use _FileWriteLog (adds date & time to the log file) or simply FileWriteLine.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Thanks.

I used _FileWriteLog

the code is:

#include <Array.au3>

#include <File.au3>

#include <File.au3>

$sLogPath = "E:FileLog.txt"

$aFileCompare = TextFileCompare("E:abc.txt", "E:abc1.txt")

_ArrayDisplay($aFileCompare)

Func TextFileCompare($sFile1, $sFile2)

If Not FileExists($sFile1) Then

_FileWriteLog($sLogPath, $sFile1)

If Not FileExists($sFile2) Then

_FileWriteLog($sLogPath, $sFile2)

EndIf

EndIf

End Func

It is working now

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

    No registered users viewing this page.

×
×
  • Create New...