Excuse the crudeness of the script.. but I wanted to share this..Wot does it do??.. hehehe It checks for a user logged onto another machine within a 40min period... also checks to see if they are spose to be on hollies!!
the hollies file should be updated every week from your local HR dept as leave is approved there... this script checks for names and dates and of course if their name is there and the current date is less than their hollies.. then alarm bells!!!
$USERIDTST = "Dave.walters"
$IDCOMP = "DAVES"
$USERID = readprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","USER NAME")
$machinename = readprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","Computer Name")
$DATE = readprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","Date")
$HOLLIEDATE = readprofilestring ("c:\dsc\DSCHOL.ini","$USERIDTST","finishdate")
$HOLLIEID = readprofilestring ("c:\dsc\DSCHOL.ini","$USERIDTST","USER NAME")
IF $USERIDTST = $HOLLIEID
IF $HOLLIEDATE > @DATE
?"Spose to be on hollies!!"
goto endit
endif
endif
IF $USERIDTST <> $USERID
?"no profile exists"
gosub update
goto endit
endif
IF $IDCOMP = $MACHINENAME AND $USERIDTST = $USERID
?"no worries!"
gosub update
else
IF $DATE <> @DATE
gosub update
else
?"CHECK THE TIMES"
?""
; some test vars, these are in the same format as @time
$start=readprofilestring ("c:\dsc\DSCSYS.ini","MISC","time")
$end=@TIME
; convert times to seconds.
$startsecs=val(substr($start, 1, 2))*3600 + val(substr($start, 4, 2))*60 + val(substr($start, 7, 2))
$endsecs=val(substr($end, 1, 2))*3600 + val(substr($end, 4, 2))*60 + val(substr($end, 7, 2))
; subtract start from end
$diffsecs=$endsecs-$startsecs
; convert difference to HH:MM:SS
$hours=$diffsecs/3600
$minutes=($diffsecs-($hours*3600))/60
$seconds=($diffsecs-($hours*3600)-($minutes*60))
; convert the numbers to strings and add leading zeros if required
if $hours<10 $hours="0$hours" else $hours="$hours" endif
if $minutes<10 $minutes="0$minutes" else $minutes="$minutes" endif
if $seconds<10 $seconds="0$seconds" else $seconds="$seconds" endif
; create string
$diff=$hours+":"+$minutes+":"+$seconds
$diff ?
if $DIFF > 00:40:00
?"shes rite!"
gosub update
else
?"ASK 'em"
endif
endif
endif
goto endit
:UPDATE
?"Update"
$NUL = Writeprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","USER NAME","$USERIDTST")
$NUL = Writeprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","Computer Name","@WKSTA")
$NUL = Writeprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","time","@TIME")
$NUL = Writeprofilestring ("c:\dsc\DSCSYS.ini","$USERIDTST","date","@DATE")
return
:endit