Home > Language Reference > LogFile and Clipboard Functions > LogFile

LogFile

The LogFile function logs into a log file line by line information during script execution.

Usage

Used to trace the different steps executed by the script.

Syntax

LogFile(<filename>, 0|1, 0|1)

Parameters

<filename>, string, name of the log file. The extension for <filename> must be .LOG if you want to be able to open the log file using File/Open Log menu in WinTask x64 Editor window. If the full path is not included in <filename>, the file is created in the scripts current working directory.

0|1. If this second parameter is set to 0, only the Comment lines are written into the log file. If it is set to 1, line by line information is written.

0|1. If this third parameter is set to 0, the log information is appended at the end of the existing log file. If it is set to 1, a new log file is created at each script execution.

Remarks

A LogFile call overrides the setting specified in Configure/Run menu.

See also

Comment
StopLog

Example

'With such a script named logfile.src:
Shell("notepad")
    LogFile("c:\Program Files (x86)\ WinTask\Logs\my_log.log",1,1)
    UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)
    SendKeys("Hello<Enter>")
    UseWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",1)
    ChooseMenu(Normal,"&File|E&xit")
UseWindow("NOTEPAD.EXE|CtrlNotifySink|Notepad|8",1)
    Click(Button,"Do&n't Save")


Open the log file my_log.log using File/Open Log menu and the log file looks like:
2011/02/03  14:38:41 logfile 3     UseWindow NOTEPAD.EXE|Edit|Untitled - Notepad|1,1
2011/02/03  14:38:41 logfile 4     SendKeys Hello<Enter>
2011/02/03  14:38:41 logfile 5     UseWindow NOTEPAD.EXE|Notepad|Untitled - Notepad,1
2011/02/03  14:38:41 logfile 6     ChooseMenu &File|E&xit
2011/02/03  14:38:42 logfile 7     UseWindow NOTEPAD.EXE|CtrlNotifySink|Notepad|8,1
2011/02/03  14:38:42 logfile 8     Click  Do&n't Save
2011/02/03  14:38:42 logfile  Ended--------------------------------------------------------