Thanks Lonkero... this was exactly what i was looking for [Smile]

code:
 
$TimeofDay = Val( SubStr(@TIME,1,2) )
Select
Case $Timeofday = 22
$timetorun = "ok"
$m=MessageBox ("Time OK",Time)
Case 1
$timetorun = "error"
$m=MessageBox ("Wrong Time",Time)
EndSelect

If $timetorun="error"
Exit 1
EndIf

the time part works correctly now...