#166567 - 2006-08-30 05:22 AM
Not Pretty
|
wreded
Fresh Scripter
Registered: 2003-11-06
Posts: 28
Loc: Montana, USA
|
i admit this isn't pretty, but i have to have this done by next Tuesday. In psuedo code it goes like this:
1. Check for a registry key 2. If not there, write it 3. If that key has a value, get it 4. Append new value to old value 5. Write new value to registry key 6. Tell everyone it was successful (or not)
In my code it looks like:
Code:
DIM $Key2Find, $LSAValue, $AddValue
$Key2Find = "HKEY_Local_Machine\System\CurrentControlSet\Control\LSA" $LSAValue = "" $AddValue = "passfilter|"
:CheckKey $RK = KeyExist("$Key2Find") IF $RK <> 0 $LSAValue = ReadValue("$Key2Find", "Notification Packages") ? "LSAValue = $LSAValue" Else $LSAValue = WriteValue("$Key2Find", "Notification Packages", "$LSAValue" + "$AddValue", "REG_MULTI_SZ") ? "LSAValue = $LSAValue" Endif GoTo CheckValue get $x
:CheckValue ? "Write new registry value?" Get $x If $x == "Y" or $x == "y" $x = InStr("$LSAValue", "passfilter") If $x = 0 $Rc = WriteValue("$Key2Find", "Notification Packages", "$LSAValue"+"$AddValue", "REG_MULTI_SZ") If @Error = 0 ? "Value written to registry" ? "New $Key2Find value: $LSAValue" Endif Else ? "Proper string already written..." ? "$LSAValue" get $y Endif Endif Get $x
i was never very good at writing functions, though i can take other's functions and make them fit my needs.
Comments greatly appreciated!
Thanks, Dave
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 641 anonymous users online.
|
|
|