Access Windows Registry from Sikuli IDE - use the bundled JNA

Asked by Chetan

is there a way we can access windows registry value from siuli ide
we did find winreg in python but that does not seem to work in ide
https://www.programcreek.com/python/example/53858/winreg.HKEY_LOCAL_MACHINE

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#2

I guess, this is because the winreg module relies on C-based stuff (normal Python), which is not supported by Jython.

I will have a look into JNA, which is bundled and used in SikuliX internally.

Read only or read/write?

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

This works:
import com.sun.jna.platform.win32.Advapi32Util as WIN32
import com.sun.jna.platform.win32.WinReg.HKEY_CURRENT_USER as HKCU

print WIN32.registryGetStringValue(HKCU, "Software\\Microsoft\\Edge\\BLBeacon", "version")

Look here for the API of the JNA modules:
http://java-native-access.github.io/jna/5.9.0/javadoc/

Revision history for this message
Chetan (cshamdas) said :
#4

Thanks RaiMan, that solved my question.

Revision history for this message
Chetan (cshamdas) said :
#5

thanks raiman for your constant help and support