Page 1 of 1

Registry plugin with variables

Posted: Tue Feb 19, 2013 11:58 am
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

Re: Registry plugin with variables

Posted: Wed Feb 20, 2013 7:17 am
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