Convert plural integer to singular

((values “patchstage” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\mykey” of (registry;x64 registry)) as integer)

…pulls back 1 plural integer. How to I make that a singular integer so I can do math with it?

What kind of math?

unique value of (it as integer) of values "patchstage" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\mykey" of (registries;x64 registries)

Just simple math. A counter:

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\mykey]” “patchstage”="{(unique value of (it as integer) of values “patchstage” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\mykey” of (registries;x64 registries)) - 1}"

Going to use it for going through our “patch remediation” baselines. Thanks much!

It is possible to do math on a plural integer, like this:

(it - 1) of (it as integer) of values "patchstage" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\mykey" of (registries;x64 registries)

And then make it singular for writing to the registry:

regset64 "[HKEY_LOCAL_MACHINE\SOFTWARE\mykey]" "patchstage"="{ unique value of (it - 1) of (it as integer) of values "patchstage" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\mykey" of (registries;x64 registries) }"