Determine existence/version of Grasshopper installed through Windows registry or other means?

David Rutten pointed me here, as I’ve got questions about the Grasshopper RHI install.

Hi there.
I’m working on deployment issues for our firm, building installer packages for various Grasshopper-related tools (using CreateInstall). I’ve gotten to the point where I’d like to check for metadata on the Grasshopper installation but can’t seem to find a reliable way to do this.

Issue #1 - Checking for an installation of Grasshopper

a) I can check to see if Grasshopper has been installed by searching the Windows registry, but it’s not reliable. It seems that Grasshopper no longer has an individual uninstall package (can’t find in Add/Remove…), and rather is uninstalled if you uninstall Rhino. However, the registry keys for Grasshopper do not appear to be cleaned on a Rhino uninstall, so my installer can get spoofed into thinking that there is a Grasshopper installed when it’s not.

b) It appears that not every Grasshopper install creates a registry entry in HKEY_LOCAL_MACHINE. On my machine, for instance, I can search for the Grasshopper key and return the directory of the .rhp file, and then verify that the file does in fact exist. On other machines, however, I have found that there is no key in the HKEY_LOCAL_MACHINE, and the registry entry in HKEY_CURRENT_USER does not include the path to the .rhp file, so I can’t verify whether it does in fact exist or if the registry is out of date.

c) I could brute-force search for the .rhp file, but I haven’t found the most reliable parent director(ies) to search in order to be exhaustive and accurate.

Issue #2 – Checking the Grasshopper Version

I would like to be able to trigger an update programmatically to a network installer (firm-sanctioned GH version) if the existing version is older than specified.

In some cases, if I can find the rhp through the HKEY_LOCAL_MACHINE key, I could theoretically parse the file path, which appears to contain the text representing the version. This seems hacky, though, and I have to learn Gentee programming language to do it (trying to avoid that). Also, as I said before, I am not guaranteed to have this path location if I am only able to find the HKEY_CURRENT_USER key. Perhaps if I could reliably find the .rhp through a brute force file search, this would be my best option.

Just thought I would put this out there to see if you have any thoughts (David?). :slight_smile: If I don’t hear anything from the community, I’m going to try to do the brute force search and parsing method…


(EDIT: Incidentally, I found that the Grasshopper dll does in fact have the version number associated with it, which is good news. The question now is whether I can reliably find the dll with brute force search…)

Just implemented a version that is working on my machine. I’m doing a brute force search for the Grasshopper.dll in the following directories:

rootdrive#\Program Files\Common Files 

rootdrive#\Users\#username#\AppData\Roaming (aka #appdata#)

Working so far. Any reason to believe I might not be covering all use cases here? I don’t mind if I miss really early/old Grasshopper installs.