Page 1 of 1

Write to robotask log from VBscript

Posted: Wed Sep 29, 2004 2:34 am
by paulus
Hi,
How do I write a message to the robotask log from a VBscript?
Adios,
Paulus

Write to robotask log from VBscript

Posted: Wed Sep 29, 2004 4:22 am
by Oleg
Use function WriteToLog(ByVal MsgType as integer, ByVal MessageStr as string, ByVal ThreadId as Long)

MsgType - Type of message
   0 - Information
   1 - warning
   2 - error

MessageStr - message to write

ThreadId - Thread ID. You can get it by system function GetCurrentThreadId (see example below). When you pass an invalid "Tread ID" (for example 0) then message will be written to system RoboTask log. Also "Thread Id" is needed in ExternalName property.

Example script:

Declare Function GetCurrentThreadId Lib "kernel32" As Long

Sub Main
   Dim i As Integer
   Dim thr As Long
   thr = GetCurrentThreadId
   For i = 0 To 10
        RoboTaskApp.WriteToLog(1 , Str(i), thr)
   Next i
End Sub