Getting all values of uninstall registry

(imported topic written by SystemAdmin)

Ok, I know I am missing a plural in here somewhere…

I want to return the key name and the DisplayName information for all keys in the microsoft uninstall path. I have it written where it returns two entries properly, but I need all the keys. What I have so far is below…

q: (if (exists value “DisplayName” of it) then (name of it &" - “& value “DisplayName” of it as string & " vr. " & value “DisplayVersion” of it as string) else (if (exists value “DisplayName” of it AND not exists value “DisplayVersion” of it) then (value “DisplayName” of it as string & " - no vr.”) else nothings)) of keys whose (value “DisplayName” of it as string as lowercase does not contain “security” AND value “DisplayName” of it as string as lowercase does not contain “update for microsoft”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry

+A: Adobe Flash Player ActiveX - Adobe Flash Player 11 ActiveX vr. 11.1.102.55

A: Adobe SVG Viewer - Adobe SVG Viewer 3.0 vr. 3.0

E: Singular expression refers to nonexistent object.

(imported comment written by Zakkus)

Its likely because some keys dont have “DisplayVersion”.

A simple solution, if you are using at least 8.1 (maybe support back in 8.0), is to use the pipe (|) operator:

(name of it &" - “& ((value “DisplayName” of it as string) |“no name”) & ((” vr. " & value “DisplayVersion” of it as string) |" - no vr.")) of keys whose (value “DisplayName” of it as string as lowercase does not contain “security” AND value “DisplayName” of it as string as lowercase does not contain “update for microsoft”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry

The | is basically a try catch, so it frees you from having to do a bunch of if/then/else statements

-Zak

(imported comment written by SystemAdmin)

Thats perfect. Thanks Zak!