Click here to return to the KiXtart HelpDesk main page...

KiXtart Script Depot

Reading and writing the Registry

Screen-shot

;
; ScriptName:  GEM_NOTE.kix
; Author:      Brian Petersen
; Date:        24.04.1998
; Description: Saves various information in Registry.
;
; ScreenSize=80x43...

break on

; Date Converting...
$Dag = @MDAYNO
$Mdr = @MONTHNO
$Aar = @YEAR
If @MDAYNO <= 9
   $DRet = "0$Dag"
   $Dag = "$DRet"
Endif
If @MONTHNO <= 9
   $Ret = "0$Mdr"
   $Mdr = "$Ret"
Endif
; " Today is $Dag.$Mdr.$Aar"


; Variable IndData...
If ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey\Note")
   $Old_Note=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey","Note")
else
   $Old_Note="There are no notes in Registry"
Endif

; Skabelon...
color w/b
cls
color w+/r
at(0,0) "   KiXtart HelpDesk 2000                                           $Dag.$Mdr.$Aar   "
color w/b

color y+/b
at(4,25) "N O T E   I   R E G I S T R Y"
color w/b

at(7,15) "Registry contains the following notes:"
at(10,15) "RegKey:"
color w+/b
at(10,25) "Note"
color w/b
at(12,15) "Value:"
color w+/b
at(12,25) "$Old_Note"
color w/b

; Choices...
COLOR y+/b
at(21,30) "1. " COLOR w+/b "New note   " COLOR y+/b "3. " COLOR w+/b "Exit "

GET $jn
if $jn=1
   goto SAVE
endif

if $jn=3
   goto MENU
endif

:SAVE
GETS $NewNote
$Note=ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey\Note")
If $Note=0
   WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey","Note","$NewNote","REG_SZ")
else
   AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey")
   WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyKey","Note","$NewNote","REG_SZ")
Endif
exit

:MENU
call "menu.kix"
exit