New Week, new start...

I modified the serialtime UDF so it uses only hours and minutes. And it works fine.. No more errors..BUT the tasks aren't scheduled!! [Frown]

code:
  
; variabelen Scheduletask function
$name='test'
$date='TODAY'
$type='ONCE'
$cmd='notepad'

; variabelen Serialtime function
$timediff='00:30'
$time='16:30'
$comps='server1','server2'
? 'one'+Chr(9)+@error; + $comps

For Each $comp In $comps
$time=serialtime(serialtime($time)+ serialtime($timediff))
$rc=scheduletask($name, $comp, $date, $time, $type, $cmd)
? 'two' +Chr(9)+@error+Chr(9)+$name+Chr(9)+$comp+Chr(9)+$date+Chr(9)+$time+Chr(9)+$type+Chr(9)+$cmd

next
:END
Sleep 30
Exit

;FUNCTION ScheduleTask
;
;ACTION Schedules a task on any computer using the Task Scheduler
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;VERSION 1.3 (made username/password/comment optional parameters, changed parameter order, added
; optional parameter for JT.EXE location, checks %PATH% for presence of JT.EXE)
;
;KIXTART BBS http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000060
;
Function scheduletask($name, $comp, $date, $time, $type, $cmd, optional $prms, optional $user, optional $pw, optional $comment, optional $typeargs, optional $jt)
Dim $jtexe[5], $shellcmd, $path
$jtpathL='c:\scripts\tools'
$jtpathS='\\server1\scripts\tools'
If $name='' OR $comp='' OR $date='' OR $time='' OR $type='' OR $cmd=''
? 'three' +Chr(9)+@ERROR
Exit 87
EndIf

; create an array of potential filepaths to jt.exe
$jtexe[0]=$jt
$jtexe[1]=$jtpathL+'\jt.exe'
$jtexe[2]=@SCRIPTDIR+'\jt.exe'
$jtexe[3]=@CURDIR+'\jt.exe'
$jtexe[4]=@STARTDIR+'\jt.exe'
$jtexe[5]=$jtpathS+'\jt.exe'
$path=Split('%PATH%',';')
For Each $jt In $path
ReDim preserve $jtexe[Ubound($jtexe)+1]
$jtexe[Ubound($jtexe)]=Join(Split($jt+'\jt.exe','\\'),'\')
? 'four' +Chr(9)+@ERROR
Next

? 'five' +Chr(9)+@ERROR
; check each filepath for the presence of jt.exe
For Each $jt In $jtexe
If Exist($jt) AND NOT (GetFileAttr($jt) & 16) AND Ubound($jtexe)+1
$jtexe=$jt
? 'six' +Chr(9)+@ERROR
EndIf
Next
Select
Case Ubound($jtexe)+1
Exit 2
Case NOT Exist($jtexe)
Exit 2
? 'seven' +Chr(9)+@ERROR
EndSelect

If Left($comp,2)<>'\\'
$comp='\\'+$comp
? 'eight' +Chr(9)+@ERROR
EndIf

If Right($name,4)<>'.job'
$name=$name+'.job'
? 'nine' +Chr(9)+@ERROR
EndIf

; delete a potentially existing task
$shellcmd = $jtexe
If $user AND $pw
$shellcmd = $shellcmd+ ' /SC "'+$user+'" "'+$pw+'"'
? 'ten' +Chr(9)+@ERROR
EndIf
$shellcmd = $shellcmd+ ' /SM '+$comp
$shellcmd = $shellcmd+ ' /SD "'+$name+'"'

Shell '%COMSPEC% /e:1024 /c '+$shellcmd+' >NUL 2>NUL'

$shellcmd = $jtexe

If $user AND $pw
? 'eleven' +Chr(9)+@ERROR
$shellcmd = $shellcmd+ ' /SC "'+$user+'" "'+$pw+'"'
EndIf

$shellcmd = $shellcmd+ ' /SM '+$comp
$shellcmd = $shellcmd+ ' /SJ ApplicationName="'+$cmd+'"'

If $prms
$shellcmd = $shellcmd+ ' Parameters="'+$prms+'"'
? 'twelve' +Chr(9)+@ERROR
EndIf

$shellcmd = $shellcmd+ ' WorkingDirectory="%SYSTEMROOT%"'
$shellcmd = $shellcmd+ ' Comment="'+$comment+'"'
$shellcmd = $shellcmd+ ' Creator="'+@userid+'"'
$shellcmd = $shellcmd+ ' Priority=Normal'
$shellcmd = $shellcmd+ ' MaxRunTime=3600000'
$shellcmd = $shellcmd+ ' DontStartIfOnBatteries=0'
$shellcmd = $shellcmd+ ' KillIfGoingOnBatteries=0'
$shellcmd = $shellcmd+ ' RunOnlyIfLoggedOn=0'
$shellcmd = $shellcmd+ ' SystemRequired=0'
$shellcmd = $shellcmd+ ' DeleteWhenDone=1'
$shellcmd = $shellcmd+ ' Suspend=0'
$shellcmd = $shellcmd+ ' StartOnlyIfIdle=0'
$shellcmd = $shellcmd+ ' KillOnIdleEnd=0'
$shellcmd = $shellcmd+ ' RestartOnIdleResume=0'
$shellcmd = $shellcmd+ ' Hidden=0'
$shellcmd = $shellcmd+ ' TaskFlags=0'

$shellcmd = $shellcmd+ ' /CTJ StartDate='+$date
$shellcmd = $shellcmd+ ' StartTime='+$time
$shellcmd = $shellcmd+ ' HasEndDate=0'
$shellcmd = $shellcmd+ ' KillAtDuration=0'
$shellcmd = $shellcmd+ ' Disabled=0'
$shellcmd = $shellcmd+ ' Type='+$type
If $typeargs
$shellcmd = $shellcmd+ ' TypeArguments='+$typeargs
? 'thirteen' +Chr(9)+@ERROR
EndIf
$shellcmd = $shellcmd+ ' /SAJ "'+$name+'"'

Shell '%COMSPEC% /e:1024 /c '+$shellcmd+' >NUL 2>NUL'
$scheduletask=@ERROR
? 'fourteen' +Chr(9)+@ERROR
Exit @ERROR
EndFunction


;FUNCTION SerialTime
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;ACTION Convert time to numbers (and back) for the purpose of performing time math
;
;VERSION 1.1
;
;KIXTART 4.20
;
;SYNTAX SERIALTIME(STRTIME)
;
;EXAMPLE $rc=SERIALTIME('02:20)
;
;KIXTART BBS http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000039
;
Function serialtime($strtime)
Dim $hours, $minutes

If InStr($strtime,':')
$strtime=Split($strtime,':')

Select
Case Ubound($strtime)<1
ReDim preserve $strtime[1]

Case Ubound($strtime)>1
$serialtime=-1
Exit 87
EndSelect

$hours=Val($strtime[0])
If $hours<0 OR $hours>23
$serialtime=-1
Exit 87
EndIf
$minutes=Val($strtime[1])
If $minutes<0 OR $minutes>59
? 'fifteen' +Chr(9)+@ERROR+Chr(9)+$serialtime
$serialtime=-1
Exit 87
EndIf
$serialtime=0.0+($hours*3600)+($minutes*60)
Else
$strtime=Val(CDbl($strtime)*1000)
If $strtime<=86400000 AND $strtime>=0
$hours=$strtime/3600/1000
$strtime=$strtime-($hours*3600*1000)
$hours=Right('00'+$hours,2)
$minutes=$strtime/60/1000
$strtime=$strtime-($minutes*60*1000)
$minutes=Right('00'+$minutes,2)
$serialtime=$hours+':'+$minutes
? 'sixteen' +Chr(9)+@ERROR+Chr(9)+$serialtime
Else
? 'seventeen' +Chr(9)+@ERROR+Chr(9)+$serialtime
$serialtime='-1'
Exit 87
EndIf
EndIf
EndFunction

code:
@error output:

one 0
sixteen 0 17:00
four 0
four 0
four 0
four 0
four 0
four 0
four 0
five 0
six 0
eight 0
nine 0
fourteen 0
two 0 test server1 TODAY 17:00 ONCE notepad
sixteen 0 17:30
four 0
four 0
four 0
four 0
four 0
four 0
four 0
five 0
six 0
eight 0
nine 0
fourteen 0
two 0 test server2 TODAY 17:30 ONCE notepad

_________________________
Co