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.

Registry plugin with variables

Got a good idea? You can suggest new features here.
Post Reply
Owel
Posts: 41
Joined: Thu May 31, 2012 5:51 am

Registry plugin with variables

Post by Owel »

Hi!

I had the problem, that the registry plugin is not able to evaluate variables. So you can just change registry values to hard coded values. But in my environment I need some kind of dynamical way.
To go into detail: an eg.result has to be written to an registry key.
I've done some research, and now I have a solution, that the registry plugin is able to handle variables (eg.ParseString did it)

I've added following code (~line 739) in the Registry.py

Code: Select all

newValue = eg.ParseString(newValue)
So this section will look like this:

Code: Select all

        #set or delete key
        try:
            if (action == 0) or (action == 1):
                newValue = eg.ParseString(newValue)
                if keyType == _winreg.REG_DWORD:
                   newValue = int(newValue)
                #change key
                _winreg.SetValueEx(regHandle, valueName, 0, keyType, newValue)
This will make the plugin able to handle {eg.result} or any other variable the correct way.

I hope this is helpfull to others, and might be merged.

Regards
Owel
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Registry plugin with variables

Post by Pako »

Yes, I think it is the lack of this plugin.
And it is quite easy to fix it.
So be patient, I'll do it in the foreseeable future.
But if someone will faster than me, so of course it can do!
EventGhost is not my program. I have no monopoly on it.

Pako
Post Reply