Here's a little snippet of code I found on http://www.BrainBuzz.com posted by MBrecht.
code:

Create Loginlog
Login-Logging that fix the open file Problem


;Writeaccess on a File from more than one User is not possible.
;This script wait 5x3 secounds for writeaccess
;
$LogFile="G:\Folder\Login.log"
$Err=0
$n=0

Do
$Err=Open(1,$LogFile,5)
If $Err<>0
If $n=0
;First wait
? "Please wait"
else
;follow waits
"."
Endif
Sleep 3
else
$Err=WriteLine(1,@DATE+";"+@TIME+";"+@SID+";"+@USERID+";"+@WKSTA+";"+@HOSTNAME+";"+@IPADDRESS0+";"+@ADDRESS+";"+@LSERVER+";"+@RSERVER+";"+@INWIN+";"+$isDFS+Chr(13)+Chr(10))
$Err=Close(1)
Endif
$n=$n+1
Until $Err=0 OR $n=5


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.