#18147 - 2002-03-01 03:23 PM
WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
Hi Guys,Im having trouble using the Writevalue command. Im trying to change the Country code when students logon via a the following code code:
WriteValue("HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}","","My Computer %computername%","REG_SZ") :start $locale = readvalue("HKEY_CURRENT_USER\Control Panel\International", "Locale") If $locale = "00000409" GOTO "changecountry" else ? "Locale is United Kingdom" exit endif sleep 5 :changecountry writevalue("HKEY_CURRENT_USER\Control Panel\International", "Locale", "00000809", "REG_SZ") If @error = 0 GOTO "start" endif
what happens is after this part of the code is executed all other commands that have been run such as drive mappings are no longer applied. so if some drivers are mapped before the registry changes are made they are no longer mapped when the user is logged on. any ideas will be appreciated. Mike
|
|
Top
|
|
|
|
#18149 - 2002-03-01 03:47 PM
Re: WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
err. thanks (i think?)
|
|
Top
|
|
|
|
#18150 - 2002-03-01 03:48 PM
Re: WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
could it be a permission problem with the registry.Mike
|
|
Top
|
|
|
|
#18152 - 2002-03-01 04:27 PM
Re: WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
yes when i take out the locale part the problem dissapears
|
|
Top
|
|
|
|
#18153 - 2002-03-01 04:30 PM
Re: WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
ok heres my whole script. (without the locale part)
code:
break off ;***************** Display Info to User *********************** ; CLS ; small Color r+/n BOX (7,10,17,71,FULL) ; at (8,26) "Pickering High School Network" Color w+/n ; IF ((@time > "00:00:00") AND (@time < "12:00:00")) at (9,15) "Good Morning," ELSE IF ((@time >= "12:00:00") AND (@time < "18:00:00")) at (9,15) "Good Afternoon," ELSE at (9,15) "Good Evening," ENDIF ENDIF ; at (10,15) @fullname at (12,15) "Please Wait Logging On" at (13,15) "Connecting to Printers, Please wait " at (15,15) ;*****************Section 4*********************** $SysNo = substr(@wksta,LEN(@WKSTA)-7,7) IF $SysNo = "SCIENCE" call \\upperserver\netlogon\science.kix endif ;***************************************************** $SysNop = substr(@wksta,LEN(@WKSTA)-8,7) IF $SysNop = "SCIENCE" call \\upperserver\netlogon\science.kix endif ;***************************************************** $SysNox = substr(@wksta,LEN(@WKSTA)-4,4) IF $SysNox = "TECH" call \\upperserver\netlogon\tech.kix endif ;***************************************************** $SysNod = substr(@wksta,LEN(@WKSTA)-5,4) IF $SysNod = "TECH" call \\upperserver\netlogon\tech.kix endif ;****************************************************** ;$SysNom = substr(@wksta,LEN(@WKSTA)-3,3) ;IF $SysNom = "SIC" ;call \\upperserver\netlogon\sic.kix ;endif ;****************************************************** $SysNog = substr(@wksta,1,4)
IF $SysNog = "GEOG" call \\upperserver\netlogon\geog.kix endif ;****************************************************** $what_rm = substr(@wksta,LEN(@WKSTA)-6,5)
IF $what_rm = "UPPER" call \\upperserver\netlogon\printers.kix endif ;****************************************************** $SysNos = substr(@wksta,1,4) IF $SysNos = "GNVQ" call \\upperserver\netlogon\gnvq.kix endif
;****************************************************** $what_lw = substr(@wksta,LEN(@WKSTA)-6,5) IF $what_lw = "LOWER" call \\upperserver\netlogon\lower.kix endif ;*********************Drive mappings************************* If InGroup("Domain Admins") use * /DELETE sleep 2 use s: \\upperserver\y2001 use t: \\upperserver\y97 use u: \\upperserver\y98 use v: \\upperserver\y99 use w: \\upperserver\y2000 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use g: \\upperserver2\admin use p: @HOMESHR at (15,15) "Drives Connected" EndIf If InGroup("Students") use * /DELETE sleep 2 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use r: \\upperserver\RESULTS use w: \\upperserver\LASS_RES use p: @HOMESHR at (15,15) "Drives Connected" EndIf If InGroup("Staff") use * /DELETE sleep 2 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use r: \\upperserver\RESULTS use g: \\upperserver2\admin use w: \\upperserver\scienceadmin use p: @HOMESHR at (15,15) "Drives Connected" EndIf at (16,15) "Dont forget to logoff when you have finished working" sleep 5 exit
And here it is with the locale part code:
break off WriteValue("HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}","","My Computer %computername%","REG_SZ") :start $locale = readvalue("HKEY_CURRENT_USER\Control Panel\International", "Locale") If $locale = "00000409" GOTO "changecountry" else ? "Locale is United Kingdom" exit endif sleep 5:changecountry writevalue("HKEY_CURRENT_USER\Control Panel\International", "Locale", "00000809", "REG_SZ") If @error = 0 GOTO "start" endif ;***************** Display Info to User *********************** ; CLS ; small Color r+/n BOX (7,10,17,71,FULL) ; at (8,26) "Pickering High School Network" Color w+/n ;
IF ((@time > "00:00:00") AND (@time < "12:00:00")) at (9,15) "Good Morning," ELSE IF ((@time >= "12:00:00") AND (@time < "18:00:00")) at (9,15) "Good Afternoon," ELSE at (9,15) "Good Evening," ENDIF ENDIF ; at (10,15) @fullname at (12,15) "Please Wait Logging On" at (13,15) "Connecting to Printers, Please wait " at (15,15) ;*****************Section 4*********************** $SysNo = substr(@wksta,LEN(@WKSTA)-7,7) IF $SysNo = "SCIENCE" call \\upperserver\netlogon\science.kix endif ;***************************************************** $SysNop = substr(@wksta,LEN(@WKSTA)-8,7) IF $SysNop = "SCIENCE" call \\upperserver\netlogon\science.kix endif ;***************************************************** $SysNox = substr(@wksta,LEN(@WKSTA)-4,4) IF $SysNox = "TECH" call \\upperserver\netlogon\tech.kix endif ;***************************************************** $SysNod = substr(@wksta,LEN(@WKSTA)-5,4) IF $SysNod = "TECH" call \\upperserver\netlogon\tech.kix endif ;****************************************************** ;$SysNom = substr(@wksta,LEN(@WKSTA)-3,3) ;IF $SysNom = "SIC" ;call \\upperserver\netlogon\sic.kix ;endif ;****************************************************** $SysNog = substr(@wksta,1,4)
IF $SysNog = "GEOG" call \\upperserver\netlogon\geog.kix endif ;****************************************************** $what_rm = substr(@wksta,LEN(@WKSTA)-6,5)
IF $what_rm = "UPPER" call \\upperserver\netlogon\printers.kix endif ;****************************************************** $SysNos = substr(@wksta,1,4) IF $SysNos = "GNVQ" call \\upperserver\netlogon\gnvq.kix endif
;****************************************************** $what_lw = substr(@wksta,LEN(@WKSTA)-6,5) IF $what_lw = "LOWER" call \\upperserver\netlogon\lower.kix endif ;*********************Drive mappings************************* If InGroup("Domain Admins") use * /DELETE sleep 2 use s: \\upperserver\y2001 use t: \\upperserver\y97 use u: \\upperserver\y98 use v: \\upperserver\y99 use w: \\upperserver\y2000 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use g: \\upperserver2\admin use p: @HOMESHR at (15,15) "Drives Connected" EndIf If InGroup("Students") use * /DELETE sleep 2 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use r: \\upperserver\RESULTS use w: \\upperserver\LASS_RES use p: @HOMESHR at (15,15) "Drives Connected" EndIf If InGroup("Staff") use * /DELETE sleep 2 use z: \\upperserver\Menus use x: \\upperserver\MultiMediaApps use y: \\upperserver\netlogon use r: \\upperserver\RESULTS use g: \\upperserver2\admin use w: \\upperserver\scienceadmin use p: @HOMESHR at (15,15) "Drives Connected" EndIf at (16,15) "Dont forget to logoff when you have finished working" sleep 5 exit
when i remove the locale code everything works fine![ 01 March 2002: Message edited by: mcloum ] [ 01 March 2002: Message edited by: mcloum ]
|
|
Top
|
|
|
|
#18154 - 2002-03-01 04:55 PM
Re: WriteValue Problems
|
Breaker
Hey THIS is FUN
   
Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
|
Mike,This code is exiting before it ever gets to the drive mappings, surely? I'm not entirely together at the moment, but I would suggest that what you're doing is: 1) Checking the country code (presumably 00000409 is the US code Windows defaults to) 2) If it is this default code, changing it, and if the change is successful, coming back to check it again. 3) Once the code is not reading 00000409, you are announcing that it is set to UK, and exiting the script. You should probably try something like this:
code:
If ReadValue("HKEY_CURRENT_USER\Control Panel\International", "Locale") <> "00000809" ;ie not UK $x = WriteValue("HKEY_CURRENT_USER\Control Panel\International", "Locale", "00000809", "REG_SZ") If $x = 0 ? "Locale set to UK." Else ? "Couldn't set locale." Exit Endif Endif ... ;script continues...
I think that should do it.HTH
_________________________
================================================ Breaker
|
|
Top
|
|
|
|
#18156 - 2002-03-01 10:33 PM
Re: WriteValue Problems
|
Anonymous
Anonymous
Unregistered
|
Sorry guys didnt spot that Exit command!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|