home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / scripts.cab / demo.kix < prev    next >
Text File  |  1999-11-04  |  2KB  |  77 lines

  1. ;  DEMO.SCR
  2. ;
  3. ;  KiXtart demonstration script of registry functions.
  4. ;
  5. ;  24-Aug-1995
  6. ;
  7. ;  Note :  This code sample is provided for demonstration purposes only.
  8. ;          Microsoft makes no warranty, either express or implied,
  9. ;          as to its usability in any given situation.
  10. ;
  11.  
  12. cls                                   ; clear the screen
  13. color w+/n
  14.  
  15. ? "START"
  16.  
  17. :start
  18. if existkey( "HKEY_CURRENT_USER\KiX32" ) <> "0"
  19.    if addkey( "HKEY_CURRENT_USER\KiX32" ) = 0
  20.       color g+/n
  21.       ? "OK, added KiX32 key."
  22.       if addkey( "HKEY_CURRENT_USER\KiX32\one" ) = 0 AND
  23.          addkey( "HKEY_CURRENT_USER\KiX32\two" ) = 0 AND
  24.          addkey( "HKEY_CURRENT_USER\KiX32\three"
  25.          ? "...and some subkeys..."
  26.          if writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value1" , "Text" , "REG_SZ" ) AND
  27.             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value2" , "line1|line2(with a || in it)|line3|" , "REG_MULTI_SZ" ) AND
  28.             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value3" , "0a12defa0b" , "REG_BINARY" ) AND
  29.             writevalue( "HKEY_CURRENT_USER\KiX32\one" , "value4" , "123456789" , "REG_DWORD" )
  30.             ? "...and now even some values..."
  31.             ? "Please check the result with REGEDT32."
  32.             ? ? "End of demo : press <anykey> to delete the key again."
  33.             get $x
  34.             $result = deltree("HKEY_CURRENT_USER\KiX32")
  35.             goto end
  36.          else
  37.             ? "Hmm, WriteValue failed with returncode : " + @error
  38.          endif
  39.       else
  40.          ? "Hmm, AddKey failed with returncode : " + @error
  41.       endif
  42.    else
  43.       ? "Hmm, AddKey failed with returncode : " + @error
  44.       end
  45.    endif
  46. else
  47.    ? "Huh ?. Key already exists ?!?."
  48.    ? "Do you want me to delete it  (Y/N) ?."
  49.  
  50.    :loop
  51.    GET $Input
  52.    if $Input = "Y"
  53.       if Deltree( "HKEY_CURRENT_USER\KiX32" )= 0
  54.          ? "OK, Key deleted......"
  55.          goto start
  56.       else
  57.          ? "Hmmm, somehow the delete failed : " + $RC
  58.          exit
  59.       endif
  60.    else
  61.       if $Input = "N"
  62.          ? "OK, then I'll just quit."
  63.          goto end
  64.       else
  65.          goto loop     ; wrong key, try again
  66.       endif
  67.    endif
  68. endif
  69.  
  70. :end
  71.  
  72. color w+/n
  73.  
  74. ? ? "END"
  75.  
  76. color w/n
  77.