Write to robotask log from VBscript

Discuss RoboTask here
Post Reply
paulus
Posts: 19
Joined: Tue Sep 14, 2004 1:51 am
Location: Netherlands

Write to robotask log from VBscript

Post by paulus »

Hi,
How do I write a message to the robotask log from a VBscript?
Adios,
Paulus
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Write to robotask log from VBscript

Post 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
Last edited by Oleg on Wed Sep 29, 2004 8:31 am, edited 1 time in total.
Post Reply