Write to registry

Write to registry

DGRL
Advisor Advisor
2,373 Views
8 Replies
Message 1 of 9

Write to registry

DGRL
Advisor
Advisor

Dear coders

 

After searching on Google and forums like this one, there is no other choose for me to post my question here.

 

 

 

Is it possible to write to the windows registry and write the following key types

1. REG_EXPAND_SZ

2. REG_MULTI_SZ

3. REG_QWORD

4. REG_BINARY

 

I know how to write REG_SZ and REG_DWORD

 

 

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
2,374 Views
8 Replies
Replies (8)
Message 2 of 9

roland.r71
Collaborator
Collaborator

You'll need Acet (AutoCAD Express Tools), afaik, for reading/writing registry keys.

 

(acet-reg-del <key> [<name>])Delete key or value from Registry.ACET
(acet-reg-get <key> [<name>])Return value from Registry.ACET
(acet-reg-prodkey)Return current product key.ACET
(acet-reg-put <key> [<name> <value>])Write a Registry key or value.ACET
(acet-reg-setactivex alst) ACET2
(acet-reg-tree-get keypath key) ACET
(acet-reg-tree-set keypath lst) ACET

 

For your request that would be:

(acet-reg-put key [name value])

Write a Registry key or value.

Arguments
key: Key name to use. 
name: If given, value name to write. 
value: If given, value to assign to name. 

Return Values
T on success. 

 

However: It doesn't say anything anywhere about different key types.

 

Edit:

Did a quick search, & There's some vl functions doing the same

vl-registry-write (val-name val-data)

But it too doesn't mention types. (are you sure it even matters?)

Message 3 of 9

DGRL
Advisor
Advisor

hi @roland.r71

 

Thanks for the reply

This seems to be a partly solution as you NEED express tools to be installed for this

I am hoping to find a way to do this without the use of 'extra installed' express tools

vl-registry-write is not able to do this afaik

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 4 of 9

DGRL
Advisor
Advisor

@roland.r71

 

Well it matters only if you need to write specific data to the reg that requires to use that kind of key

(vl-registry-write)  can only write REG-SZ and REG_DWORD.

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 5 of 9

_gile
Consultant
Consultant

Hi

 

As far I know this is not possible simply because AutoLISP does not know types like 64 bits integers, binary data or unexpanded references to environment variables.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 6 of 9

DGRL
Advisor
Advisor

@_gile 

 

Thanks for the reply and thanks for this info

Will look for other ways to achieve this.

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 7 of 9

roland.r71
Collaborator
Collaborator

Just a thought:

If there is a way to execute a .reg file from acad, you could just write your own using lisp & execute.

 

So, instead of writing straight to the registry, you write a text file (myRegKeys.reg) & import that into the registry. I know the first part is relatively easy, but i'm not sure if you can import the .reg file into the registry from acad/lisp. (otherwise: a double click inwindows file explorer is enough to import the data)

0 Likes
Message 8 of 9

DGRL
Advisor
Advisor

@roland.r71

 

The execution of the .reg needs to be done without user approval and i do not know if that is possible

Have to test this

Thanks for the idea.

 

 

 

If this was of any help please kudo and/or Accept as Solution
Kind Regards
0 Likes
Message 9 of 9

dgorsman
Consultant
Consultant

If users have restricted rights that will apply to calls to (vl-registry-write...) as well.

 

If they do have appropriate rights, this sounds like the perfect job for a dotNET DLL.  Define a couple of extra LISP functions with extra arguments for the other data types.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes