Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How do I set and get a registry value from a variable?

If you have a question or need help, this is the place to be.
Post Reply
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

How do I set and get a registry value from a variable?

Post by Mastiff »

I tried to google on the site, but I couldn't find the answer to this. I need to know the right python code to set and get registry values (I want to use the registry to keep values that are consistent after a reboot and can be shared between Girder and EG). I'm sure it's pretty simple once you know it, I just couldn't find it in the documentation or on the site.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How do I set and get a registry value from a variable?

Post by Pako »

Registry.png
Registry.png (11.39 KiB) Viewed 3000 times
These actions are unsatisfactory for you?
Pako
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: How do I set and get a registry value from a variable?

Post by Mastiff »

Thanks for answering! It's not that. It's that I need something that I can put in an "if then" script with tons of variables. I would have to create a gazillion single actions to do all that I want to do with thes. :lol:
kkl
Experienced User
Posts: 317
Joined: Wed May 04, 2011 9:32 pm

Re: How do I set and get a registry value from a variable?

Post by kkl »

I would think you could use the built-in command as Pako suggests, then right-click on the action created and select "Copy as Python". That will give you the syntax which you can use in a python script and substitute variables.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: How do I set and get a registry value from a variable?

Post by Pako »

kkl wrote:I would think you could use the built-in command as Pako suggests, then right-click on the action created and select "Copy as Python". That will give you the syntax which you can use in a python script and substitute variables.
That's what I had in mind.

Pako
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: How do I set and get a registry value from a variable?

Post by Mastiff »

Wow, thanks! I had no idea that was possible! :shock: This is the code I get:

Code: Select all

eg.plugins.System.RegistryChange(2147483649L, u'Software\\Automatisering\\Styring av ovner\\Hjornesoverom', u'Aktivert', 0, None, u'0')
Is it possible to convert the number that ends with an L to what it actually should be, which is HKEY_CURRENT_USER? This did not work:

Code: Select all

eg.plugins.System.RegistryChange(u'HKEY_CURRENT_USER', u'Software\\Automatisering\\Styring av ovner\\Hjornesoverom', u'Aktivert', 0, None, u'0')
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: How do I set and get a registry value from a variable?

Post by jonib »

Mastiff wrote:Is it possible to convert the number that ends with an L to what it actually should be, which is HKEY_CURRENT_USER? This did not work:
Why do you want/need to do this?

I guess you could do like this:

Code: Select all

HKEY_CURRENT_USER = 2147483649L
And then use HKEY_CURRENT_USER instead of the number.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: How do I set and get a registry value from a variable?

Post by Mastiff »

Right, of course! I could do that as a variable in a startup action! Thanks! The reason I want to do that is that I will have a whole lot of these things in my scripts, and I want to be able to see what part of the registry they are saved to.
Post Reply