i´ve a Problem to edit some Values in HKCU during the Logon on W2K Clients. I want to change (as sample) the Value for the Word XP Template Path. When i run the Scipt after the logon, it works. But nothing happens during the logon. Who can help or have ideas ?
;Word Dokumentenordner if exist ("C:\wa32\office\Office10\winword.exe") $Subkey="HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Word\Options" $entry="DOC-PATH" $datatype="REG_EXPAND_SZ" $expression="O:\" $errmsg="Word XP Document Folder could not set"
gosub CheckKey endif
return
:CheckKey $RCCheck = Keyexist("$Subkey") if $RCCheck = 1 gosub WriteKey else ? "Subkey does not exist, i create it" ? $RC = addkey ("$Subkey") if $RC = 0 ? "Subkey created" gosub Writekey else ? "Error during the cration of the Subkey" + $Subkey +" "+ @Error + " " + @SError $RC = LogEvent(1,1,"Error during the cration of the Subkey " + $Subkey +" "+ @Error + " " + @SError ,"","OffXPInit/CheckKey" ) endif endif return
might not be perfect but does not have that fuzzy gosub thingie anymore... it was hard to follow. what is the error reported with this script if not work?
btw, the script is copy-pasteable to any editor directly.
[ 08. May 2003, 14:38: Message edited by: Lonkero ]
Now it works. Thank you for your Script. It was a mistake of me. One If statment in the main Script wasn´t closed Sorry! I think i have to learn debugging. :-(
yeah... btw, have you started testing already with 4.12 or 4.21 RC?
there is already pretty much changed since 4.02
I see that your syntax is kinda 3.xx still but with some playing around with the new stuff alone and with the help of the board think you will could kick onto the next level!
If after your first error that you could not add the key, you then go on to try and write to that key. Yes, I know it is fast and won't cause a problem, but better coding would no longer attempt to go further as the key can not be created, thus it can not be written to.