/*
$dateadd([DATE,]AMOUNT,FACTOR)
*/
alias dateadd {
var -s %t,%r,%n $crlf,%com = dd $+ $ticks,%d = $iif($3,$qt($1),Date),%e = $iif($3,$2,$1),%f = $qt($iif($3,$3,$2))
if ($istok(95 98,$os,32)) return 2
%t = Dim sd %n Dim ret %n sd = %d %n
%t = %t ret = DateAdd( $qt($replace($upper(%f),y,YYYY,w,WW)) , %e , sd) %n MsgBox(ret)
echo -a %t
comopen %com MSScriptControl.ScriptControl
if ($comerr) return E_COM
noop $com(%com,language,4,bstr*,vbscript)
if ($com(%com,executestatement,1,bstr*,%t)) && ($com(%com,eval,1,bstr*,ret)) %r = $com(%com).result
else return 1 $v1 $v2
:error
if ($com(%com)) .comclose %com $com(%com,reset,1)
return %r
}