; *** Display Box ***:starthere
CLS
color Y+/n
$nul=box(3,3,17,26,"double")
$nul=box(3,28,9,59,"double")
color w+/n
AT (3-1,3)"Rename Computer Utility"
color w/n
AT (5,30)"Room number :"
AT (7,30)"Computer number :"
gosub firstroutine
gosub secondroutine
AT (12,29)"Your new computername will be: "
color w+/n
AT (14,29)"$Schl-$Rnum-$Cnum "
color w/n
AT (16,29)"Is this correct? Enter Y(es) or N(o)"
:correct
GET $correct
if $correct="N" or $correct="n" goto starthere endif
if $correct="Y" or $correct="y" goto changename endif
goto correct
:changename
WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","$Schl-$Rnum-$Cnum","REG_SZ")
if @ERROR=0
AT (16,29)"The computername has been changed. "
AT (17,29)"Press any key to continue."
GET $dummy
exit
else
AT (16,29)"Sorry, the Computername could not be changed. Please try again."
AT (17,29)"Press any key to continue."
GET $dummy
goto starthere
endIf
exit
:firstroutine
DIM $select[13]
DIM $result[13]
$select[0]=" Administration " $result[0]="AD"
$select[1]=" Baldwin " $result[1]="BA"
$select[2]=" Booker T. Washington " $result[2]="BW"
$select[3]=" Burling " $result[3]="BU"
$select[4]=" Carson " $result[4]="CA"
$select[5]=" Central " $result[5]="CE"
$select[6]=" Delair " $result[6]="DE"
$select[7]=" Fine " $result[7]="FI"
$select[8]=" Franklin " $result[8]="FR"
$select[9]=" Longfellow " $result[9]="LO"
$select[10]=" Roosevelt " $result[10]="RO"
$select[11]=" Middle School " $result[11]="PM"
$select[12]=" High School " $result[12]="PH"
; *** Define default variables ***
$crlf=chr(13)+chr(10)+chr(13)+chr(10)
$tline=0 $aline=4
; *** Add default Helptext ***
$helptext=" Valid keys are: "+$crlf+
" <Arrow Up> / <Arrow Down> "+$crlf+
" <Enter> = Exit with selection "+$crlf+
" <Esc> = Exit without answer "+$crlf
; *** Show lines ***
color w+/b AT ($tline+4,4)$select[$tline] color w/n
$tline=1
while $tline<13
AT ($tline+4,4)$select[$tline]
$tline=$tline+1
loop
AT (12,29)"Select your current location "
; *** Push Key Routine ***
:keyinput
get $key
select
case @ERROR=59 ; * Function key {F1} *
$nul=messagebox($helptext,"Select",32,0)
case $key="P" ; * ARROW DOWN *
if $aline<16
$aline=$aline+1
endif
case $key="H" ; * ARROW UP *
if $aline>4
$aline=$aline-1
endif
case $key=chr(27) ; * ESCAPE *
$Schl=""
exit
case $key=chr(13) ; * ENTER *
$Schl=$Result[$aline-4]
return
endselect
if $aline>4 AT ($aline-1,4)$select[$aline-5] endif
color w+/b AT ($aline,4)$select[$aline-4] color w/n
if $aline<16 AT ($aline+1,4)$select[$aline-3] endif
goto keyinput
:secondroutine
$Rnum=""
$Cnum=""
if $Schl="AD"
AT (5,30)"Users first name:"
AT (7,30)"Users last name :"
endif
:room
if $Schl="AD"
AT (12,29)"Enter your first name "
else
AT (12,29)"Enter your room number "
endif
color w+/n AT(5,48)$Rnum get $chr color w/n
$chr=ucase($chr)
select
case $chr=chr(8) ; * Backspace *
if len($Rnum)>0
$Rnum=substr($Rnum,1,len($Rnum)-1)
at(5,48)" "
endif
case $chr=chr(13) ; * Enter *
if len($Rnum)>0
goto computer
endif
case asc($chr)=>48 and asc($chr)<=57 ; * Number *
if len($Rnum)<10
$Rnum=$Rnum+$chr
endif
case asc($chr)=>65 and asc($chr)<=90 ; * Letter *
if len($Rnum)<10
$Rnum=$Rnum+ucase($chr)
endif
endselect
goto room
:computer
if $Schl="AD"
AT (12,29)"Enter your last name "
else
AT (12,29)"Enter your computer number "
endif
color w+/n AT(7,48)$Cnum get $chr color w/n
$chr=ucase($chr)
select
case $chr=chr(8) ; * Backspace *
if len($Cnum)>0
$Cnum=substr($Cnum,1,len($Cnum)-1)
at(7,48)" "
endif
case $chr=chr(13) ; * Enter *
if len($Cnum)>0
return
endif
case 48<=asc($chr) and asc($chr)<=57
if len($Cnum)<10
$Cnum=$Cnum+$chr
endif
case asc($chr)=>65 and asc($chr)<=90 ; * Letter *
if len($Cnum)<10
$Cnum=$Cnum+ucase($chr)
endif
endselect
goto computer
return