It seams to be a quite popular forum question when it comes to the vl-registry-write method, but I can't seam to get it right. Dose anybody know how I can append two keys one which is a REG_DWORD and the other a REG_BINARY key all I'm able to do is create and append REG_SZ keys?
Solved! Go to Solution.
Solved by The_Caddie. Go to Solution.
and here some of the tests i have conducted so far (none to any avail)
(defun C:hwa1 () (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" "Flags" "00082621 REG_DWORD") (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" "FeatureData =hex:7f,02,00,00,5b,02,00,00,7f,02,00,00") ) (defun C:HWA2 () (setq MYHWA1 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "Flags" "=dword:00082622")) (setq MYHWA2 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "FeatureData" "=hex:7f,02,00,00,5b,02,00,00,7f,02,00,00")) (vl-registry-write MYHWA1) (vl-registry-write MYHWA2) ) (defun C:HWA3 () (setq MYHWA1 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "hello stuipid" "00082622")) (setq MYHWA2 (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" "FeatureData" "3" "7f,02,00,00,5b,02,00,00,7f,02,00,00")) (vl-registry-write MYHWA1) (vl-registry-write MYHWA2) ) (defun C:HWA4 () (vl-registry-write (strcat "HKEY_CURRENT_USER\\Software\\" (VLAX-PRODUCT-KEY) "\\3DGS Configuration\\GSHEIDI10" ) "LOADCTRLS" 2) ) (defun C:HWA5 () (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R18.2\\ACAD-A001:409\\3DGS Configuration\\GSHEIDI10" REG_DWORD "Flags" "hello") ) (defun C:hwa6 () (setq f(open "C:/test2.bat" "w")) (write-line "\"HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409\3DGS Configuration\GSHEIDI10\" /v Flags /t REG_DWORD /d 00082602 /f" f) ;(write-line \"HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.2\ACAD-A001:409\3DGS Configuration\GSHEIDI10\" /v FeatureData /t REG_BINARY /d 7f,02,00,00,5b,02,00,00,7f,02,00,00 /f" f) (close f) ;REG ADD "HKCU\Control Panel\Desktop" /v BackgroundColor /t REG_BINARY /d ffffff00 /f (command "_.shell" "C:\test2.bat") )
can use vl-registry-wite only for strings... try this, hkcu is the key and n is the binary number
HTH
(setq wssh (vlax-create-object "WScript.Shell"))
(vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 17) "REG_BINARY")
(vlax-release-object wssh)
im a little lsot as the following error message keeps poping up?
; error: lisp value has no coercion to VARIANT with this type: nil
(vl-load-com)
(setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\Flags") n 534052)
(setq wssh (vlax-create-object "WScript.Shell"))
(vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_DWORD")
(vlax-release-object wssh)
i am using a long integer decimal value for the flags, i do not know what it does, but it will change it.in the registry
you will have to know which variant data type to use, 2 3 4 5 8 etc
nice the dword works but the binary fails?
(vl-load-com) (setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\Flags") n 534050) (setq wssh (vlax-create-object "WScript.Shell")) (vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_DWORD") (vlax-release-object wssh) (setq hkcu (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\3DGS Configuration\\GSHEIDI10\\FeatureData") n 7f 02 00 00 5b 02 00 00 7f 02 00 00) (setq wssh (vlax-create-object "WScript.Shell")) (vlax-invoke-method wssh 'RegWrite hkcu (vlax-make-variant n 3) "REG_BINARY") (vlax-release-object wssh)
please assign n to a correct value, in this case it should be an array of binary values
then you should use the correct variant data type, in this case 8192
for example (vlax-make-variant safearray 8192)
you should do more research, i have been successful with simple binary data editing
example (vlax-make-variant 0 17)
never had the need to do list of binary data, but should be doable, if u know what u are doing.
HTH