Click here for a screen shot of the GUI in this script.

AddExtender("WWPST44I.DLL")
Addextender("WWWNT34I.DLL")
rcp="c:\recip.txt"
:TOP
MyDialogFormat=`WWWDLGED,5.0`

MyDialogCaption=`Drive Mirror Utility -Author: Chuck Arconi`
MyDialogX=10
MyDialogY=33
MyDialogWidth=197
MyDialogHeight=189
MyDialogNumControls=11

MyDialog01=`28,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"Start Mirror",1`
MyDialog02=`28,46,138,DEFAULT,EDITBOX,path,"Mirror from path..."`
MyDialog03=`28,64,138,DEFAULT,EDITBOX,pathto,"Mirror to path..."`
MyDialog04=`98,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"Maintenance",4`
MyDialog05=`66,162,64,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",5`
MyDialog06=`70,14,44,DEFAULT,STATICTEXT,DEFAULT,"Drive Mirror Utility"`
MyDialog07=`90,82,76,DEFAULT,EDITBOX,out,"c:\mirror.txt"`
MyDialog08=`90,96,76,DEFAULT,EDITBOX,ttt,"00:00:00:24:00:00"`
MyDialog09=`26,84,64,DEFAULT,STATICTEXT,DEFAULT,"Log File Path and Name"`
MyDialog10=`26,98,64,DEFAULT,STATICTEXT,DEFAULT,"Time to Start Mirror"`
MyDialog11=`94,110,64,DEFAULT,STATICTEXT,DEFAULT,"Default Time is 12:00am"`

ButtonPushed=Dialog("MyDialog")
;debug(1)
If ButtonPushed==5 then exit
If ButtonPushed==1 then goto TIME
If ButtonPushed==4 then goto MAINT


:TIME
BoxOpen("Caution", "Mirror running for %path% to %pathto%.%@CRLF%%@CRLF%Mirror is scheduled to start at %ttt%%@CRLF%%@CRLF%Please do not interrupt!")
while 1
TimeWait(ttt)
;now see if it is m-f
a=TimeYmdHms()
b=TimeJulianDay(a)
c=(b+5) mod 7
if (c==0) || (c==6) then continue ; if the day if Sunday or Saturday, then transfer control back to while loop for re-eval
goto MIRROR
endwhile


:MIRROR
option_1=' /MIR /Z /R:3 /W:10 /LOG+:'
option_2=strcat(pathto,option_1,out)

BoxOpen("MIRROR","Data Mirror has started please do not interrupt....%@CRLF%%@CRLF%The name of the log file is %out%.")
RunHideWait('c:\Robocopy.exe','%path% %option_2%')
BoxShut()

fp=FileOpen(rcp,"read")
while @TRUE ; Loop till break do us end
x = FileRead(fp)
If x == "*EOF*" Then Break
host="ntex01.affymetrix.com"
fromaddr="Helpdesk@affymetrix.com"
userid="carcon"
password="charlie"
port=""
tolist="%x%"
cclist=""
bcclist=""
subject="Mirror Utility Update"
msg="The Mirror Utility has completed. Attached is the log file for the latest run. "
attachments="%out%"
flags=""
kInit(host,fromaddr,userid,password,port)
kDest(tolist,cclist,bcclist)
kSendText(subject,msg,attachments,flags)
endwhile
FileClose(fp)
goto TOP

:MAINT
RecipFormat=`WWWDLGED,5.0`
RecipCaption=`Mirror Utility Maintenance`
RecipX=35
RecipY=54
RecipWidth=105
RecipHeight=85
RecipNumControls=2

Recip01=`20,20,64,DEFAULT,PUSHBUTTON,DEFAULT,"Mail Recipients",6`
Recip02=`20,40,64,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",8`

ButtonPushed=Dialog("Recip")
If ButtonPushed==6
runwait("notepad.exe",rcp)
goto MAINT
endif

If ButtonPushed==8 then goto TOP