More fun with GUIDs in relevance

(imported topic written by deschodt91)

Hello all,

I am trying to base some relevance off the existence of an uninstall string in the registry…

This type of relevance normally works great: exists key “blah” of key “HKLM\Software\microsoft\windows\currentversion\uninstall” of registry returns TRUE if “blah” exists… Great !

Problem is, again, I need to use a GUID for this specific case… So it’s same as above but using exists key “{02AF-5454545etc}” of key…etc…

That key exists, yet QNA returns FALSE every time - it’s a copy-paste job so it’s not a typo… I remember Ben advised me to use double “{{” in actions as “{” gets dropped, but that does not seem to do the trick either in relevance, QNA says FALSE, sorry, have a nice day… Hmmm…

Any ideas ?

(imported comment written by BenKus)

Hi deschodt,

This should work in QnA every time:

q: exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{210A2188-5796-4D64-812C-050463C34236}” of registry
A: True

q: exists key “{210A2188-5796-4D64-812C-050463C34236}” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry
A: True

If you are using this relevance in an action, you need to escape the open “{” so that the action doesn’t get confused and think that you want to substitute relevance, so it would look something like:

waithidden msiexec -x {{210A2188-5796-4D64-812C-050463C34236}

So in the above example, there is no relevance substitution at all… but if you do want to substitute relevance in an action that contains “{}”, then you actually need to escape the “}” so that the action doesn’t get confused and close your relevance expression early:

waithidden “{value “UninstallString” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{210A2188-5796-4D64-812C-050463C34236}}” of registry}”

Fun stuff? Does that help?

Ben

(imported comment written by deschodt91)

It does, thanks… I have no idea why it did not work on that specific GUID I was using yesterday, but it works on others, so I guess I got unlucky trying a bad one as my first attempt !