Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get registry key value and process it

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
The_Caddie
1135 Views, 4 Replies

Get registry key value and process it

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?

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: The_Caddie


@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. 

Message 3 of 5
scot-65
in reply to: 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.


Message 4 of 5
The_Caddie
in reply to: The_Caddie

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"))

 

 

Message 5 of 5
scot-65
in reply to: The_Caddie

 

(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.


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost