LogFile

Logfile management function.

The LogFile function forces the script to log each statement executed into the specified logfile. Not available in WinTask Lite.

Usage

Mainly used to trace in a text file all the statements executed by the script.

Syntax

LogFile(<filename>,<type>,<mode>)

Parameters

<filename>: name of the file where the statements executed after this function are written. The extension must be .LOG if you want to be able to open the logfile using File/Open Log menu. If the full path is not included in <filename>, the file is created in the scripts current directory.

<type>: 1 for a full logfile, 0 for a limited logfile (only statements Comment are written into the logfile).

<mode>: 1 to delete the logfile before writing, 0 to add the new statements at the end of the logfile.

Remarks

This statement redefines the setting specified in TaskEdit (menu Configure|Run).

Example

 

Script : Untitled1.src

 

Shell("notepad")

LogFile("c:\Program Files\WinTask\Logs\history.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|#32770|Notepad",1)

Click(Button,"&No")

 

If you have specified a logfile using the Configure Run dialog, two files are created in the Logs subdirectory: " Untitled1.log " and " History.log "; the second log is created by the LogFile function.

Those two files can be opened with a text editor like WordPad or in WinTask Editor, select menu File|Open Log.

 

File Untitled1.log:

 

2009/02/01

15 :43:10

Untitled1

 

Started

 

2009/02/01

15 :43:11

Untitled1

1

Shell

notepad

2009/02/01

15 :43:11

Untitled1

2

LogFile

c :\Program Files\WinTask\Logs\history.log,1,1

 

File History.log:

 

2009/02/01

15 :43:12

Untitled1

3

UseWindow

NOTEPAD.EXE|Edit|Untitled - Notepad|1,1

2009/02/01

15 :43:14

Untitled1

4

SendKeys

Hello<Enter>

2009/02/01

15 :43:15

Untitled1

5

UseWindow

NOTEPAD.EXE|Edit|Untitled - Notepad,1

 

2009/02/01

15 :43:16

Untitled1

6

ChooseMenu

Normal,&File|E&xit

2009/02/01

15 :43:16

Untitled1

7

UseWindow

NOTEPAD.EXE|#32770Notepad,1

 

2009/02/01

15 :43:17

Untitled1

8

Click

Button,&No

2009/02/01

15 :43:17

Untitled1

8

Ended