Announcement

Collapse
No announcement yet.

A problem using the 'Registry.GetValue' action

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A problem using the 'Registry.GetValue' action

    Hi there, I try to get a specific Registry value's data using this script:


    sImVer = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\ImageMagick\\Current", "Version", true);

    Dialog.Message("ImageMagickVersion", sImVer, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    -- Check to see if an error occurred.
    error = Application.GetLastError();
    -- If an error occurred, display the error message.
    if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end


    But a blank string is returned, and I do not receive any message about errors, using Application.GetLastError().

    What could be wrong?

  • #2
    It looks like the registry key does not carry a value and is empty. Remember that, if this code is being run on a x64 operating system, the key being inspected is actually HKEY_LOCAL_MACHINE\Software\Wow6432Node\ImageMagick\Current

    ​​​​​​​Ulrich

    Comment


    • #3
      Yes, I use Windows 7 x64.

      I tried this: Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\ImageMagick\\Current", "Version", true)
      but still the same, it returns a blank string.

      I am positive that the registry key carries a value and it is not empty (see the screenshot).

      Comment


      • #4
        Your screenshot shows the 64-bit registry. As I mentioned in my previous reply, without additional help, your code will be reading from the 32-bit registry at Wow6432Node - the read operation is redirected by the operation system.

        I developed this plugin a long time ago to overcome this limitation.

        Ulrich

        Comment


        • #5
          Ok, I will try your plugin and reply soon.
          Regards

          Comment

          Working...
          X