You need to call tcInit() before you call any tcLib functions. tcInit() will declare the arrays the first time it is called, and initialize them with appropriate values on each subsequent call. Simply follow the Call statement with a tcInit() function call and your problem will be resolved.

You're calling the tcGetTasks without an initial call to tcInit. The real problem is that tcInit not only initializes the task arrays, but several common parameters, such as the location of JT.EXE.

Glenn

PS - here's an example script that will gather the tasks from a remote system, locate tasks with a specific user ID and change the credentials:


break on
 
; Define the old/new credentials 
$OldUser = 'OldUser'
$NewUser = 'NewUser'
$NewPass = 'password123'	
 
; Must be the correct path, such as '.\tclib.kxf' or 'c:\lib\tclib.kxw' 
Call 'C:\Local\Lib\tclib.kxf'
; Always follow the library load with a tcInit to define all the constants and arrays 
tcInit()
 
; Define ONE computer to test the code 
; Once it has been tested, wrap the code between the START and END tags with code 
; to enumerate a list (array or file contents) of computers 
$Computer = 'TestServer'
 
; ## START ## 
  $Events = tcGetTasks($Computer)
  @SERROR ?
  For Each $Event in $Events
    'Processing ' $Event ?
    tcInit(1)
    tcGetEvent($Computer, $Event)
    ' Current UserID: ' $a_tcTask[20] ?
    If $a_tcTask[20] = $OldUser
      tcSetEventCredentials($Computer, $Event, $NewUser, $NewPass)
    EndIf
  Next
 
; ## END ## 
 
 
 
 
_________________________
Actually I am a Rocket Scientist! \:D