;*********************************;
; Curriculum Network Logon Script ;
;*********************************;;************************************************************
;** Globals
;**
If SetConsole ("MINIMIZE") = 0
? "Console shrunk......"
Endif
$TRUE = 1
$FALSE = 0
;**********************************************************
; These are the settings for the KixPop 1.1 program
DIM $greeting
$drive1 = " "
$connect1 = " "
$drive2 = " "
$connect2 = " "
$drive3 = " "
$connect3 = " "
$drive4 = " "
$connect4 = " "
$drive5 = " "
$connect5 = " "
$drive6 = " "
$connect6 = " "
$drive7 = " "
$connect7 = " "
$favourites = "Your Internet Favourites"
$favConnect = "OK"
; Turn break on
Break Off
; Start of Script
:MAIN
; Set output to ASCII
Dim $PreviousASCIIState
$PreviousASCIIState = SetASCII ("ON")
Color W+/N
;Set the local time to the same as the server
SETTIME @LSERVER
; Clear the screen
Cls
; Display greeting to user
IF ((@time > "00:00:00") AND (@time < "12:00:00"))
$greeting = "Good Morning @FULLNAME"
ELSE
IF ((@time >= "12:00:00") AND (@time < "18:00:00"))
$greeting = "Good Afternoon @FULLNAME"
ELSE
$greeting = "Good Evening @FULLNAME"
ENDIF
ENDIF
; Progress meter init
$Progress = 0
$TotalProgress = 37 ; 36 is a 'full' bar
$Found = 0
$YearCount = 1992
; REM Setup the shared read only work area
$drive1 = "Files Drive"
use f: "\\gandalf\files"
$connect1 = "OK"
$drive2 = "Shared Access Drive"
use h: "\\gandalf\WorkShare$"
$connect2 = "OK"
; REM Setup the Lower 6th form work area
if ingroup("L6") = 1
$drive3 = "6th Form Drive"
use y: "\\gandalf\L6$"
$connect3 = "OK"
$drive4 = "6th Form Drive"
use u: "\\gandalf\ucas$"
$connect4 = "OK"
endif
; REM Setup the Upper 6th form work area
if ingroup("U6") = 1
$drive3 = "6th Form Drive"
use y: "\\gandalf\U6$"
$connect3 = "OK"
$drive4 = "6th Form Drive"
use u: "\\gandalf\ucas$"
$connect4 = "OK"
endif
; REM Setup the Electronics work area
if ingroup("electronics") = 1
$drive6 = "Electronics Drive"
use r: "\\gandalf\electronics$"
$connect6 = "OK"
endif
; REM Setup the History Internet work area
if ingroup("history") = 1
$drive5 = "History Drive"
use x: "\\gandalf\history$"
$connect5 = "OK"
endif
; REM Setup the staff work areas
if ingroup("staff") = 1
$drive3 = "Staff Home Drive"
use y: "\\gandalf\staff$"
$connect3 = "OK"
$drive4 = "Students Drives"
use t: "\\gandalf\users$"
$connect4 = "OK"
endif
; REM Setup the Drivers form work area
if ingroup("drivers") = 1
$drive7 = "Drivers Resource Area"
use g: "\\gandalf\drivers$"
$connect7 = "OK"
$drive3 = "Home Drive for @fullname"
use y: "\\gandalf\sbutterworth$"
$connect3 = "OK"
$drive5 = "Web's Drive"
use w: "\\gandalf\webs$"
$connect5 = "OK"
$drive4 = "UCAS Drive"
use u: "\\gandalf\ucas$"
$connect4 = "OK"
$drive6 = "Audit Drive"
use n: "\\gateway\audit$"
$connect6 = "OK"
endif
; REM Setup the Web Teams shared work area
if ingroup("Student Web Team") = 1
$drive7 = "Splat Online Drive"
use w: "\\gandalf\splat$"
$connect7 = "OK"
endif
; REM Setup the Key Skills shared work area
if ingroup("keyskills") = 1
$drive5 = "Key Skills Drive"
use k: "\\gandalf\keyskills$"
$connect5 = "OK"
endif
if ingroup("1997") = 1
$drive3 = "1997 Drive"
use y: "\\gandalf\1997$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("1998") = 1
$drive3 = "1998 Drive"
use y: "\\gandalf\1998$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("1999") = 1
$drive3 = "1999 Drive"
use y: "\\gandalf\1999$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2000") = 1
$drive3 = "2000 Drive"
use y: "\\gandalf\2000$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2001") = 1
$drive3 = "2001 Drive"
use y: "\\gandalf\2001$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2002") = 1
$drive3 = "2002 Drive"
use y: "\\gandalf\2002$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2003") = 1
$drive3 = "2003 Drive"
use y: "\\gandalf\2003$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2004") = 1
$drive3 = "2004 Drive"
use y: "\\gandalf\2004$" ; REM Map drive
$connect3 = "OK"
endif
if ingroup("2005") = 1
$drive3 = "2005 Drive"
use y: "\\gandalf\2005$" ; REM Map drive
$connect3 = "OK"
endif
goSub OfficeKeys
gosub FavouritesLocation
gosub motd
$arguments = "$greeting;$drive1;$connect1;$drive2;$connect2;$drive3;$connect3;$drive4;$connect4;$drive5;$connect5;$drive6;$connect6;$drive7;$connect7;$favourites;$favConnect;$motd"
$style = "dialogWidth:400px;dialogHeight:455px;help:no;scroll:no"
shell '%comspec% /c kixwin "@curdir\logonbox.htm" "$arguments" "$style"'
; Reset the output mode
$X = SetASCII ($PreviousASCIIState)
Quit
;****************************************************
:motd
;****************************************************
;Message of the day section
IF EXIST ("@ldrive\message.ini")
$motd = ReadProfileString("@ldrive\message.ini", "general", "message")
If @ERROR = 0
$motd = $motd + Chr(13) + Chr(10)
Endif
SELECT
CASE InGroup("2001")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "2001", "message")
If @ERROR = 0
Endif
CASE InGroup("2000")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "2000", "message")
If @ERROR = 0
Endif
CASE InGroup("1999")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "1999", "message")
If @ERROR = 0
Endif
CASE InGroup("1998")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "1998", "message")
If @ERROR = 0
Endif
CASE InGroup("1997")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "1997", "message")
If @ERROR = 0
Endif
CASE InGroup("u6")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "u6", "message")
If @ERROR = 0
Endif
CASE InGroup("l6")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "l6", "message")
If @ERROR = 0
Endif
CASE InGroup("staff")
$motd = $motd + ReadProfileString("@ldrive\message.ini", "staff", "message")
If @ERROR = 0
Endif
CASE InGroup("drivers")
$motd = $motd + ReadProfileString("@ldrive\message.ini","drivers","message")
If @ERROR = 0
Endif
CASE 1
$motd = ReadProfileString("@ldrive\message.ini", "general", "message")
If @ERROR = 0
Endif
ENDSELECT
endif
Return
;****************************************************
:OfficeKeys
;****************************************************
; This section inserts the users name into the MS Office Reg Keys
$counter=1
$Initials=""
$x = len (@userid)
while $counter =< $x
$Y=substr (ucase(@userid),$counter,1)
$ascii=asc ($y)
$hex=dectohex ($ascii)
$counter=$counter+1
;the spaces are to force at stringcopy.
$Initials=" "+$Initials+$hex+"00"
loop
$Initials=ltrim ($Initials) +"00" +"00"
$counter=1
$Name=""
$x = len (@fullname)
while $counter =< $x
$Y=substr (@fullname,$counter,1)
$ascii=asc ($y)
$hex=dectohex ($ascii)
$counter=$counter+1
$Name=" "+$Name+$hex+"00"
loop
$Name=ltrim ($Name) +"00" +"00"
;Check the keys for Office 97 Pro
$ikey="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Common\UserInfo"
IF (ExistKey($ikey) = 0)
$rs = Writevalue("HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Common\UserInfo","UserInitials",$Initials,"reg_binary")
$rs = Writevalue("HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Common\UserInfo","UserName",$Name,"reg_binary")
ENDIF
; Set the Home Page for Internet Explorer
$rs = writevalue ("Software\Microsoft\Internet Explorer\Main", "Start Page", "http://www.kixtart.org", "REG_SZ")
; Set the header and the footer in Internet Explorer to read the users name
; This helps with printout collection.
$rs = writevalue ("Software\Microsoft\Internet Explorer\PageSetup", "header", "@FULLNAME&bPage &p of &P", "REG_SZ")
$rs = writevalue ("Software\Microsoft\Internet Explorer\PageSetup", "footer", "&u", "REG_SZ")
Return
;****************************************************
:FavouritesLocation
;****************************************************
$favorites_location="Y:\@userid\favorites"
;At ( $LineCount, 1) " Favorites Location"
$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
IF (ExistKey($ikey) = 0)
IF (len(ReadValue($ikey,"Favorites")) <> 0)
IF (WriteValue($ikey, "Favorites", $favorites_location, "REG_SZ") <> 0)
;? "Warning "+@error+": "+@serror
ELSE
;? "Update: "+$ikey
ENDIF
ENDIF
ENDIF
$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
IF (ExistKey($ikey) = 0)
IF (len(ReadValue($ikey,"Favorites")) <> 0)
IF (WriteValue($ikey, "Favorites", $favorites_location, "REG_SZ") <> 0)
;? "Warning "+@error+": "+@serror
ELSE
;? "Update: "+$ikey
ENDIF
ENDIF
ENDIF
$ikey="HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
IF (ExistKey($ikey) = 0)
IF (len(ReadValue($ikey,"Favorites")) <> 0)
IF (WriteValue($ikey, "Favorites", $favorites_location, "REG_SZ") <> 0)
;? "Warning "+@error+": "+@serror
ELSE
;? "Update: "+$ikey
ENDIF
ENDIF
ENDIF
$ikey="HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
IF (ExistKey($ikey) = 0)
IF (len(ReadValue($ikey,"Favorites")) <> 0)
IF (WriteValue($ikey, "Favorites", $favorites_location, "REG_SZ") <> 0)
;? "Warning "+@error+": "+@serror
ELSE
;? "Update: "+$ikey
ENDIF
ENDIF
ENDIF
IF (Exist($favorites_location) = 0)
md $favorites_location
ENDIF
Return