I would like to capture a regestry key value ussing autolisp if the value of they key equals TEXTEXAMPLE then exit Autocad else nothing.
How can I do this?
Solved! Go to Solution.
Solved by scot-65. Go to Solution.
@The_Caddie wrote:I would like to capture a regestry key value ussing autolisp if the value of they key equals TEXTEXAMPLE then exit Autocad else nothing.
How can I do this?
(if (eq (vl-registry-read key) str)(then...))
You're question is too vague The_Caddie.
GETENV is what you are looking for when you want to grab a registry key
that is in the general configuration section (and possibly a few others)
where the key does not contain any dots or spaces.
If the key is not in the general configuration area, or the key (and/or path)
has dots or spaces, you must use VL-REGISTRY-READ and long path to it.
Here is an example:
(vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "CPROFILE") "\\Drawing Window") "ScreenMenu.Position"))
For both situations above the key / path is CasE SensiTive.
Hope this helps.
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
This dosnt work for me???
(if (eq (vl-registry-read "HKEY_CURRENT_USER\\Software\\TOMMY\\TIMMY\\") "1")(ALERT "THE KEY EXISTS AND IS SET TO 1") (Alert "THE KEY DOSE NOT EXIST"))
(vl-registry-read "HKEY_CURRENT_USER\\Software\\TOMMY\\TIMMY")
By removing the last "\\" TIMMY becomes a key (or subkey) and not a "folder".
If TIMMY is a key, and there are subkeys inside, you have to point to the subkey: "...\\TOMMY\\TIMMY\\Gender".
vl-registry-descendents provides a list of (sub)keys, if present.
(vl-registry-write "HKEY_CURRENT_USER\\Test" "" "test data")
Where "" shows there is no subkeys.
(vl-registry-write "HKEY_CURRENT_USER\\Test" "SUBKEY1" "test data1")
(vl-registry-write "HKEY_CURRENT_USER\\Test" "SUBKEY2" "test data2")
Shows subkeys.
In tree structure:
test = test data
test = test data ;(in the registry it is sometimes called "(Default)")
subkey1 = test data1
subkey2 = test data2
Help does not fully explain the key/subkey relationships. Experiment as needed.
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.